Returns all nodes and edges of this graph as an associative file matrix.
@access		public
@param		string	$filename		URI of File Matrix to write
@return		AssocFileMatrix
@todo		rebuild for KeyMatrix / MatrixWriter
325045
public function toMatrix(  $filename = false )
	{
		if( $filename) $m = new AssocFileMatrix( $filename );
		else $m = new AssocMatrix();

		$nodes = $this->getNodes();
		foreach( $nodes as $source )
		{
			echo $source->getNodeName()."<br>";
			foreach( $nodes as $target )
			{
				if( $this->isEdge($source, $target ) || $this->isEdge($target, $source ) )
				{
					$value = $this->getEdgeValue( $source, $target );
				}
				else $value = 0;
				$m->addValueAssoc( $source->getNodeName(), $target->getNodeName(), $value );
			}
		}
		return $m;
	}
277394
private function hashFile(string $filename) {
    $hash = hash_hmac_file(
      $this->algorithm,
      $filename,
      $this->key
    );

    return $this->validate($hash);
  }
921744
public function splitFilename($filename)
    {
        $result = ['', '', ''];
        if (is_string($filename)) {
            $result[1] = $filename;
            $slashAt = strrpos(str_replace('\\', '/', $result[1]), '/');
            if ($slashAt !== false) {
                $result[0] = substr($result[1], 0, $slashAt + 1);
                $result[1] = (string) substr($result[1], $slashAt + 1);
            }
            $dotAt = strrpos($result[1], '.');
            if (($dotAt !== false) && ($dotAt > 0)) {
                $result[2] = (string) substr($result[1], $dotAt + 1);
                $result[1] = substr($result[1], 0, $dotAt);
            }
        }

        return $result;
    }
1150856
protected function fileOrUrl($filename)
    {
        $options = array();
        if (!empty($this->httpBasicAuth) || !empty($this->httpUserAgent)) {
            $options['http'] = array();
            $options['http']['header'] = array();

            if (!empty($this->httpBasicAuth)) {
                $username  = $this->httpBasicAuth['username'];
                $password  = $this->httpBasicAuth['password'];
                $basicAuth = base64_encode("{$username}:{$password}");

                array_push($options['http']['header'], "Authorization: Basic {$basicAuth}");
            }

            if (!empty($this->httpUserAgent)) {
                array_push($options['http']['header'], "User-Agent: {$this->httpUserAgent}");
            }
        }

        $context = stream_context_create($options);

        if (($lines = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES, $context)) === false) {
            throw new \Exception("The file path or URL '{$filename}' does not exist.");
        }

        return $lines;
    }
429108
public function toFile($filename)
    {
        $filename = Yii::getAlias($filename);
        FileHelper::createDirectory(dirname($filename));
        return $this->toStream(fopen($filename, 'w+'));
    }
641052
public function getLogFilenameList($filename = null)
    {
        $data = [];

        if (empty($filename)) {
            $filename = '*.*';
        }

        $files = $this->getLogFileList($filename);

        if (is_array($files)) {
            foreach ($files as $file) {
                $basename = pathinfo($file, PATHINFO_BASENAME);
                $data[$basename] = $file;
            }
        }

        return $data;
    }
1248311
public function getFilePath($fileName = null)
    {
        if ($fileName === null) {
            $fileName = $this->fileName;
        }

        $component = $this->component;
        $path = $component->getPath().'/'.$fileName;

        /*
         * Check the shared "/partials" directory for the partial
         */
        if (!File::isFile($path)) {
            $sharedDir = dirname($component->getPath()).'/partials';
            $sharedPath = $sharedDir.'/'.$fileName;
            if (File::isFile($sharedPath)) {
                return $sharedPath;
            }
        }

        return $path;
    }
326582
public function getHash($fileName)
    {
        if (array_key_exists($fileName, $this->data)) {
            return $this->data[$fileName];
        } else if (array_key_exists($this->_makeRelative($fileName), $this->data)) {
            return $this->data[$this->_makeRelative($fileName)];
        } else {
            return null;
        }
    }
213002
protected function getFileParts($filename)
    {
        if (preg_match('/(.*)@(\d+)x\.(.*)$/', $filename, $matches)) {
            $name = $matches[1];
            $extension = $matches[3];
            $extra = (int) $matches[2];
            $type = 'alternative';

            if ($extra === 1) {
                $type = 'base';
                $extra = null;
            }
        } else {
            $fileParts = explode('.', $filename);

            $name = array_shift($fileParts);
            $extension = null;
            $extra = null;
            $type = 'base';

            while (($part = array_shift($fileParts)) !== null) {
                if ($part !== 'meta' && $part !== 'thumb') {
                    if (null !== $extension) {
                        $name .= '.' . $extension;
                    }
                    $extension = $part;
                } else {
                    $type = $part;
                    $extra = '.' . $part . '.' . implode('.', $fileParts);
                    break;
                }
            }
        }

        return array($name, $extension, $type, $extra);
    }
158657
public static function read( $fileName )
	{
		$list	= array();
		if( !file_exists( $fileName ) )
			throw new RuntimeException( 'File "'.$fileName.'" is not existing' );
		$reader	= new FS_File_Reader( $fileName );
		$lines	= $reader->readArray();
		foreach( $lines as $line )
			if( $line = trim( $line ) )
				if( !preg_match( self::$commentPattern, $line ) )
					$list[]	= $line;
		return $list;
	}
504737
public function path($filename)
    {
        if (preg_match('~^' . $this->base_directory . '~', $filename)) {
            return $filename;
        }

        return rtrim($this->base_directory, '/') . '/' . ltrim($filename, '/');
    }
540830
public static function split($fileName)
    {
        $ext = pathinfo($fileName);
        return [
            $ext['dirname'],
            $ext['filename'],
            empty($ext['extension']) ? '' : $ext['extension']
        ];
    }
1346109
public function getFile($fileName)
    {
        $result = false;

        if (isset($_FILES[$fileName])) {
            $result = $_FILES[$fileName];
        }

        return $result;
    }
393885
public function getContents(string $fileName)
    {
        if (!file_exists($this->__path . $fileName)) {
            return null;
        }
        $r = include $this->__path . $fileName;
        return $r === false ? null : $r;
    }
1309987
public function getNamesWithDifferentExtension(string $fileName)
    {
        if (! file_exists($this->basePath)) {
            return [];
        }

        $extension = pathinfo($fileName, PATHINFO_EXTENSION);

        $baseName = substr($fileName, 0, strlen($fileName) - strlen($extension) - 1);

        $allNames = scandir($this->basePath);

        $namesWithDifferentExtension = array_filter($allNames, function ($existingName) use ($baseName, $extension) {
            $existingExtension = pathinfo($existingName, PATHINFO_EXTENSION);

            $existingBaseName = substr($existingName, 0, strlen($existingName) - strlen($existingExtension) - 1);

            return $existingBaseName === $baseName && $existingExtension !== $extension;
        });

        return array_values($namesWithDifferentExtension);
    }
146448
public function getFileData($fileName)
    {
        return new ArchiveEntry($this->inArchiveFileName, filesize($this->fileName),
            $this->uncompressedSize, $this->modificationTime);
    }
1374812
public function buildMenuFromOpmlFile( $fileName )
	{
		$list	= Alg_Tree_Menu_Converter::convertFromOpmlFile( $fileName, $this->rootLabel );
		return $this->buildMenuFromMenuList( $list );
	}