protected function generateFile($targetPathAndFilename, $fileContent, $force = false)
    {
        if (!is_dir(dirname($targetPathAndFilename))) {
            \Neos\Utility\Files::createDirectoryRecursively(dirname($targetPathAndFilename));
        }

        if (substr($targetPathAndFilename, 0, 11) === 'resource://') {
            list($packageKey, $resourcePath) = explode('/', substr($targetPathAndFilename, 11), 2);
            $relativeTargetPathAndFilename = $packageKey . '/Resources/' . $resourcePath;
        } elseif (strpos($targetPathAndFilename, 'Tests') !== false) {
            $relativeTargetPathAndFilename = substr($targetPathAndFilename, strrpos(substr($targetPathAndFilename, 0, strpos($targetPathAndFilename, 'Tests/') - 1), '/') + 1);
        } else {
            $relativeTargetPathAndFilename = substr($targetPathAndFilename, strrpos(substr($targetPathAndFilename, 0, strpos($targetPathAndFilename, 'Classes/') - 1), '/') + 1);
        }

        if (!file_exists($targetPathAndFilename) || $force === true) {
            file_put_contents($targetPathAndFilename, $fileContent);
            $this->generatedFiles[] = 'Created .../' . $relativeTargetPathAndFilename;
        } else {
            $this->generatedFiles[] = 'Omitted as file already exists .../' . $relativeTargetPathAndFilename;
        }
    }
protected function generateFile($targetPathAndFilename, $fileContent, $force = false)
    {
        if (!is_dir(dirname($targetPathAndFilename))) {
            \Neos\Utility\Files::createDirectoryRecursively(dirname($targetPathAndFilename));
        }

        if (substr($targetPathAndFilename, 0, 11) === 'resource://') {
            list($packageKey, $resourcePath) = explode('/', substr($targetPathAndFilename, 11), 2);
            $relativeTargetPathAndFilename = $packageKey . '/Resources/' . $resourcePath;
        } elseif (strpos($targetPathAndFilename, 'Tests') !== false) {
            $relativeTargetPathAndFilename = substr($targetPathAndFilename, strrpos(substr($targetPathAndFilename, 0, strpos($targetPathAndFilename, 'Tests/') - 1), '/') + 1);
        } else {
            $relativeTargetPathAndFilename = substr($targetPathAndFilename, strrpos(substr($targetPathAndFilename, 0, strpos($targetPathAndFilename, 'Classes/') - 1), '/') + 1);
        }

        if (!file_exists($targetPathAndFilename) || $force === true) {
            file_put_contents($targetPathAndFilename, $fileContent);
            $this->generatedFiles[] = 'Created .../' . $relativeTargetPathAndFilename;
        } else {
            $this->generatedFiles[] = 'Omitted as file already exists .../' . $relativeTargetPathAndFilename;
        }
    }
protected function generateFile ( $ targetPathAndFilename , $ fileContent , $ force = false ) { if ( ! is_dir ( dirname ( $ targetPathAndFilename ) ) ) { \ Neos \ Utility \ Files :: createDirectoryRecursively ( dirname ( $ targetPathAndFilename ) ) ; } if ( substr ( $ targetPathAndFilename , 0 , 11 ) === 'resource://' ) { list ( $ packageKey , $ resourcePath ) = explode ( '/' , substr ( $ targetPathAndFilename , 11 ) , 2 ) ; $ relativeTargetPathAndFilename = $ packageKey . '/Resources/' . $ resourcePath ; } elseif ( strpos ( $ targetPathAndFilename , 'Tests' ) !== false ) { $ relativeTargetPathAndFilename = substr ( $ targetPathAndFilename , strrpos ( substr ( $ targetPathAndFilename , 0 , strpos ( $ targetPathAndFilename , 'Tests/' ) - 1 ) , '/' ) + 1 ) ; } else { $ relativeTargetPathAndFilename = substr ( $ targetPathAndFilename , strrpos ( substr ( $ targetPathAndFilename , 0 , strpos ( $ targetPathAndFilename , 'Classes/' ) - 1 ) , '/' ) + 1 ) ; } if ( ! file_exists ( $ targetPathAndFilename ) || $ force === true ) { file_put_contents ( $ targetPathAndFilename , $ fileContent ) ; $ this -> generatedFiles [ ] = 'Created .../' . $ relativeTargetPathAndFilename ; } else { $ this -> generatedFiles [ ] = 'Omitted as file already exists .../' . $ relativeTargetPathAndFilename ; } }
Generate a file with the given content and add it to the
generated files

@param string $targetPathAndFilename
@param string $fileContent
@param boolean $force
@return void
Generate a file with the given content and add it to the generated files