Método que procesa un recurso para su copia en el DocumentRoot
@param string $string
@param string $name
@param boolean $return
@param string $filenamePath
@return mixed
@throws \PSFS\base\exception\GeneratorException
550578
private static function processAsset($string, $name, $return, $filenamePath)
    {
        $filePath = $filenamePath;
        if (file_exists($filenamePath)) {
            list($base, $htmlBase, $filePath) = AssetsParser::calculateAssetPath($string, $name, $return, $filenamePath);
            //Creamos el directorio si no existe
            GeneratorHelper::createDir($base . $htmlBase);
            //Si se ha modificado
            if (!file_exists($base . $filePath) || filemtime($base . $filePath) < filemtime($filenamePath)) {
                if ($htmlBase === 'css') {
                    self::processCssLines($filenamePath);
                }
                self::putResourceContent($name, $filenamePath, $base, $filePath);
            }
        }

        return $filePath;
    }
358957
public function process_resource($manifestroot, &$fname, $folder) {
        $file = empty($folder) ? $manifestroot.'/'.$fname : $manifestroot.'/'.$folder.'/'.$fname;
        if (!file_exists($file) && $this->throwonerror) {
            throw new Exception('The file doesnt exist!');
        }

        GetDepFiles($manifestroot, $fname, $this->folder, $this->files);
        array_unshift($this->files, $folder.$fname);
        $this->init_empty_new();
        $this->href             = $folder.$fname;
        $this->identifierref    = $folder.$fname;
        $this->filename         = $fname;
        $this->isempty          = false;
        $this->folder           = $folder;
    }
579375
public function actionIsInstalled($name=false, $return = false)
	{
		if ($name == false)
			throw new CHttpException(400, Yii::t('Api.Theme', 'Missing theme name'));

		$installed 	= $this->actionInstalled();
		$keys 		= array_keys($installed);
		
		if (in_array($name, $keys))
			return true;

		if ($return)
			return false;

		return $this->returnError(200, Yii::t('Api.main', 'Theme is not installed'), false);
	}
287865
public static function findDomainPath($string, $filePath)
    {
        $domains = Template::getDomains(TRUE);
        $filenamePath = null;
        if (!file_exists($filePath) && 0 < count($domains)) {
            foreach ($domains as $domain => $paths) {
                $domainFilename = str_replace($domain, $paths["public"], $string);
                if (file_exists($domainFilename)) {
                    $filenamePath = $domainFilename;
                    continue;
                }
            }
        }

        return $filenamePath;
    }
766412
protected function load($filename, $data = array(), $return = false)
    {
        $template = $this->createSubTemplate();

        try {
            return $template->renderTemplate($filename, $data, $return);
        } catch (\Exception $exception) {
            if (!empty($this->log))
            {
                $this->log->error("Failed to render template " . $filename, $exception);
            }
            return '';
        }
    }
902080
public function processMethodReturn(array $method, string $file, string $name)
    {
        if (!empty($method['docblock']['inheritdoc'])) {
            return;
        }

        if (empty($method['docblock']['return'])) {
            $this->warnings[] = [
                'type' => 'return-missing',
                'file' => $file,
                'class' => $name,
                'method' => $name,
                'line' => $method['line'],
            ];
        } elseif (is_array($method['return'])) {
            $docblockTypes = explode('|', $method['docblock']['return']);
            sort($docblockTypes);
            if ($method['return'] != $docblockTypes) {
                $warnings = true;
                $this->warnings[] = [
                    'type' => 'return-mismatch',
                    'file' => $file,
                    'class' => $name,
                    'method' => $name,
                    'line' => $method['line'],
                    'return-type' => implode('|', $method['return']),
                    'doc-type' => $method['docblock']['return'],
                ];
            }
        } elseif ($method['docblock']['return'] != $method['return']) {
            if ($method['return'] == 'array' && substr($method['docblock']['return'], -2) == '[]') {
                // Do nothing because this is fine.
            } else {
                $this->warnings[] = [
                    'type' => 'return-mismatch',
                    'file' => $file,
                    'class' => $name,
                    'method' => $name,
                    'line' => $method['line'],
                    'return-type' => $method['return'],
                    'doc-type' => $method['docblock']['return'],
                ];
            }
        }
    }
1221737
protected static function calculateResourcePathname($filenamePath, $source)
    {
        $sourceFile = preg_replace("/'/", "", $source[1]);
        if (preg_match('/\#/', $sourceFile)) {
            $sourceFile = explode("#", $sourceFile);
            $sourceFile = $sourceFile[0];
        }
        if (preg_match('/\?/', $sourceFile)) {
            $sourceFile = explode("?", $sourceFile);
            $sourceFile = $sourceFile[0];
        }
        $orig = realpath(dirname($filenamePath) . DIRECTORY_SEPARATOR . $sourceFile);
        return $orig;
    }
43176
private function __createAnnotation($name, $string)
    {
        switch ($name) {
            case 'link':
                $annotation = new Annotation\Link($name, $string);
                $annotation->getLinkText();
                break;

            case 'return':
                $annotation = new Annotation\ReturnAnnotation($name, $string);
                $annotation->getReturnType();
                break;

            case 'see':
                $annotation = new Annotation\See($name, $string);
                $annotation->getResource();
                break;

            default:
                $annotation = new Annotation($name, $string);
                break;
        }

        return $annotation;
    }
327406
public static function csvFileToArrayGenerator(string $filename = '', string $delimiter = ',')
    {
        $complete = false;
        try {
            $header = null;
            if (($handle = fopen($filename, 'r')) !== false) {
                while (($row = fgetcsv($handle, 4096, $delimiter)) !== false) {
                    if (!$header) {
                        $header = $row;
                    } else {
                        yield array_combine($header, $row);
                    }
                }
            }
            $complete = true;
        } finally {
            if (!$complete) {
                // cleanup when loop breaks
            } else {
                // cleanup when loop completes
            }
        }
        // Do something only after loop completes
    }
753175
private function methodInvoke($name, $namespace)
    {
        $name = ucfirst($name);

        $this->uses[] = $namespace . '\\' . $name;

        $namespace = '\\' . $namespace . '\\';

        $parameters = [
            new ParameterGenerator(
                'command', $namespace . $name
            ),
        ];

        return new MethodGenerator(
            '__invoke',
            $parameters,
            MethodGenerator::FLAG_PUBLIC,
            '',
            new DocBlockGenerator(
                'Handle command',
                null,
                [
                    new ParamTag('command', [ $namespace . $name]),
                ]
            )
        );
    }
958301
static String getFile( String name )
        throws FileNotFoundException, IOException
    {
        StringBuilder sb = new StringBuilder();
        try ( BufferedReader bin = new BufferedReader( new FileReader( name ) ) ) {
            String line;
            while ( (line=bin.readLine()) != null )
                sb.append( line ).append( "\n" );
        }
        return sb.toString();
    }
735690
public static function export($className, $name, $return = false)
    {
        $export = new self($className, $name);
        $export = (string)$export;
        if ($return === true) {
            return $export;
        } else {
            echo $export;

            return null;
        }
    }
1170208
public static function GetXmlReaderInstanceForSourceFile($filePath, $fileName = null) {
        if (!isset($fileName)) {
            $fileName = substr($filePath, strrpos($filePath, "/") + 1);
        }
        $xmlFilesLoaded = apc_fetch(\Puzzlout\Framework\Enums\CacheKeys::XmlFilesLoaded);
        if (array_key_exists($fileName, $xmlFilesLoaded)) {
            $this->xmlReader = $xmlFilesLoaded[$fileName];
        } else {
            $this->xmlReader = isset($fileName) ?
                    new \Puzzlout\Framework\Core\XmlReader(null, $configFileName) :
                    new \Puzzlout\Framework\Core\XmlReader($filePath);
            $xmlFilesLoaded[$configFileName] = $this->xmlReader;
            apc_add(\Puzzlout\Framework\Enums\CacheKeys::XmlFilesLoaded, $xmlFilesLoaded);
        }
    }
389330
public static function fromName(string $name, ?Throwable $previous = null): DuplicateHelperException
    {
        $message = sprintf('Duplicate helper: %s', $name);

        return new static($message, $name, $previous);
    }
67693
private static void getFilesByNameRecursive(Collection<File> filesList, File path, String name)
    {
        Optional.ofNullable(path.listFiles()).ifPresent(files -> Arrays.asList(files).forEach(content ->
        {
            if (content.isFile() && content.getName().equals(name))
            {
                filesList.add(content);
            }
            else if (content.isDirectory())
            {
                getFilesByNameRecursive(filesList, content, name);
            }
        }));
    }
798810
public function _fetchContents( $filePath, $fname = false )
    {
        if ( $fname )
            $fname .= "::_fetchContents($filePath)";
        else
            $fname = "_fetchContents($filePath)";
        $metaData = $this->_fetchMetadata( $filePath, $fname );
        // @todo Throw an exception
        if ( !$metaData )
        {
            eZDebug::writeError( "File '$filePath' does not exist while trying to fetch its contents.", __METHOD__ );
            return false;
        }

        // @todo Catch an exception
        if ( !$contents = $this->dfsbackend->getContents( $filePath ) )
        {
            eZDebug::writeError("An error occurred while reading contents of DFS://$filePath", __METHOD__ );
            return false;
        }
        return $contents;
    }
1196427
public function createChildFile($name)
    {
        if (
            strpos($name, '\\') !== false
            || strpos($name, '/') !== false
            || strpos($name, '..') !== false
        ) {
            throw new InvalidArgumentException("Wrong file name {$name}");
        }

        $class = $this->fileClass;

        return new $class($this->absolutePath . '/' . $name);
    }