protected function writeFile($filePath, $content)
    {
        $this->validateOutputDirectoryPermissions();

        $currentDirectory = dirname($filePath);
        if (!is_writable($currentDirectory)) {
            throw new \OxidEsales\UnifiedNameSpaceGenerator\Exceptions\PermissionException(
                'Could not create file ' . $filePath . ' ' .
                'The directory ' . $currentDirectory . ' is not writable for user "' . get_current_user() . '". ' .
                'Please fix the permissions on this directory and run this script again.',
                static::ERROR_CODE_FILE_CREATION_ERROR
            );
        }

        $fileHandle = fopen($filePath, 'wb');
        if (!$fileHandle) {
            throw new \OxidEsales\UnifiedNameSpaceGenerator\Exceptions\FileSystemCompatibilityException(
                'Could not open file file handle for ' . $filePath . ' ' .
                'There might be a problem with your file system. Try to solve this problem and run this script again.',
                static::ERROR_CODE_FILE_CREATION_ERROR
            );
        }

        $result = fwrite($fileHandle, $content);
        if (false === $result) {
            fclose($fileHandle);
            throw new \Exception(
                'Could not create file ' . $filePath,
                static::ERROR_CODE_FILE_CREATION_ERROR
            );
        }
        if (0 === $result) {
            fclose($fileHandle);
            throw new \Exception(
                'Created empty file ' . $filePath,
                static::ERROR_CODE_FILE_CREATION_ERROR
            );
        }
        fclose($fileHandle);
    }
protected function writeFile($filePath, $content)
    {
        $this->validateOutputDirectoryPermissions();

        $currentDirectory = dirname($filePath);
        if (!is_writable($currentDirectory)) {
            throw new \OxidEsales\UnifiedNameSpaceGenerator\Exceptions\PermissionException(
                'Could not create file ' . $filePath . ' ' .
                'The directory ' . $currentDirectory . ' is not writable for user "' . get_current_user() . '". ' .
                'Please fix the permissions on this directory and run this script again.',
                static::ERROR_CODE_FILE_CREATION_ERROR
            );
        }

        $fileHandle = fopen($filePath, 'wb');
        if (!$fileHandle) {
            throw new \OxidEsales\UnifiedNameSpaceGenerator\Exceptions\FileSystemCompatibilityException(
                'Could not open file file handle for ' . $filePath . ' ' .
                'There might be a problem with your file system. Try to solve this problem and run this script again.',
                static::ERROR_CODE_FILE_CREATION_ERROR
            );
        }

        $result = fwrite($fileHandle, $content);
        if (false === $result) {
            fclose($fileHandle);
            throw new \Exception(
                'Could not create file ' . $filePath,
                static::ERROR_CODE_FILE_CREATION_ERROR
            );
        }
        if (0 === $result) {
            fclose($fileHandle);
            throw new \Exception(
                'Created empty file ' . $filePath,
                static::ERROR_CODE_FILE_CREATION_ERROR
            );
        }
        fclose($fileHandle);
    }
protected function writeFile ( $ filePath , $ content ) { $ this -> validateOutputDirectoryPermissions ( ) ; $ currentDirectory = dirname ( $ filePath ) ; if ( ! is_writable ( $ currentDirectory ) ) { throw new \ OxidEsales \ UnifiedNameSpaceGenerator \ Exceptions \ PermissionException ( 'Could not create file ' . $ filePath . ' ' . 'The directory ' . $ currentDirectory . ' is not writable for user "' . get_current_user ( ) . '". ' . 'Please fix the permissions on this directory and run this script again.' , static :: ERROR_CODE_FILE_CREATION_ERROR ) ; } $ fileHandle = fopen ( $ filePath , 'wb' ) ; if ( ! $ fileHandle ) { throw new \ OxidEsales \ UnifiedNameSpaceGenerator \ Exceptions \ FileSystemCompatibilityException ( 'Could not open file file handle for ' . $ filePath . ' ' . 'There might be a problem with your file system. Try to solve this problem and run this script again.' , static :: ERROR_CODE_FILE_CREATION_ERROR ) ; } $ result = fwrite ( $ fileHandle , $ content ) ; if ( false === $ result ) { fclose ( $ fileHandle ) ; throw new \ Exception ( 'Could not create file ' . $ filePath , static :: ERROR_CODE_FILE_CREATION_ERROR ) ; } if ( 0 === $ result ) { fclose ( $ fileHandle ) ; throw new \ Exception ( 'Created empty file ' . $ filePath , static :: ERROR_CODE_FILE_CREATION_ERROR ) ; } fclose ( $ fileHandle ) ; }
Write a given content to a given file path

@param string $filePath Path to the class file
@param string $content  Content of the class file

@throws \Exception
Write a given content to a given file path