$data ) { $key = var_export( $key, true ); $versionCode = var_export( $data['version'], true ); $fileContent .= << array( 'version' => $versionCode, 'path' => {$data['path']} ), MANIFEST_CODE; $fileContent .= PHP_EOL; } return self::buildFile( $fileName, $fileContent ); } /** * Builds the contents for the PSR-4 manifest file. * * @param string $fileName The filename we are building. * @param array $namespaces The formatted PSR-4 data for the manifest. * * @return string|null $manifestFile */ private static function buildPsr4Manifest( $fileName, $namespaces ) { $fileContent = PHP_EOL; foreach ( $namespaces as $namespace => $data ) { $namespaceCode = var_export( $namespace, true ); $versionCode = var_export( $data['version'], true ); $pathCode = 'array( ' . implode( ', ', $data['path'] ) . ' )'; $fileContent .= << array( 'version' => $versionCode, 'path' => $pathCode ), MANIFEST_CODE; $fileContent .= PHP_EOL; } return self::buildFile( $fileName, $fileContent ); } /** * Generate the PHP that will be used in the file. * * @param string $fileName The filename we are building. * @param string $content The content to be written into the file. * * @return string $fileContent */ private static function buildFile( $fileName, $content ) { return <<