@param string|null $file
@param int|null $line

@return bool
436174
public function headerSent(string &$file = null, int &$line = null) : bool
    {
        return headers_sent($file, $line);
    }
269250
public static void checkValidFile(final File file) {
        checkNotNull("file", file);
        if (!file.exists()) {
            throw new IllegalArgumentException("The file '" + file + "' does not exist!");
        }
        if (!file.isFile()) {
            throw new IllegalArgumentException("The name '" + file + "' is not a file!");
        }
    }
957777
public static function process($file = NULL){

        $exists = isset( self::$data[ self::$level ] );

        if( $exists ){
            $variables = self::$data[ self::$level ];

            foreach( $variables as $key => $value ){
                global $$key;
                $$key = $value;
            }
        }

        if( $file ){
            require $file;
        }

    }
458553
public function setParseInfo($file, $line, $char = null)
    {
        $this->setFile($file);
        $this->setLine($line);

        if (null !== $char) {
            $this->setChar($char);
        }

        return $this;
    }
644719
public function file( $file = null )
	{
		if ( !is_null( $file ) )
		{
			return $this->_file = $file;
		}
		
		return $this->_file;
	}
670604
public function write($line)
    {
        return $this->pipes !== null ? fwrite($this->pipes[0], $line . PHP_EOL) : false;
    }
1365677
protected function tailFile($file, $lines)
    {
        $handle = fopen($file, "r");
        $linecounter = $lines;
        $pos = -2;
        $beginning = false;
        $text = [];
        while ($linecounter > 0) {
            $t = " ";
            while ($t != "\n") {
                if (fseek($handle, $pos, SEEK_END) == -1) {
                    $beginning = true;
                    break;
                }
                $t = fgetc($handle);
                $pos--;
            }
            $linecounter--;
            if ($beginning) {
                rewind($handle);
            }
            $text[$lines - $linecounter - 1] = fgets($handle);
            if ($beginning) {
                break;
            }
        }
        fclose($handle);
        return array_reverse($text);
    }
1325966
public static function exists($file, $type = null)
    {
        if (!$type) {
            return file_exists($file);
        }

        $ret = false;

        if ($type === 'file') {
            $ret = is_file($file);
        } elseif ($type === 'dir') {
            $ret = is_dir($file);
        } elseif ($type === 'link') {
            $ret = is_link($file);
        }

        return $ret;
    }
1038361
public function current($file = null)
    {
        $splFileInfo = $file ?: parent::current();

        return $this->transformer->transform($splFileInfo);
    }
1225663
public function validatePhpFile($file)
    {
        if (!$this->canValidatePhpCode()) {
            return null;
        }

        $output = shell_exec('php -l ' . escapeshellarg($file));

        $count = 0;
        $error = preg_replace('/Errors parsing.*$/', '', $output, -1, $count);
        return $count > 0 ? trim("$error") : true;
    }
614417
public static function type(String $file, $element = NULL)
    {
        if( ! is_file($file) )
        {
            return false;
        }

        $return = mime_content_type($file);

        if( $element === NULL )
        {
            return $return;
        }

        return explode('/', $return)[$element] ?? false;
    }
672543
function _rfile ($file = null) {
		if ( is_readable($file) ) {
			if ( !($fh = fopen($file, 'r')) ) return false;
			$data = fread($fh, filesize($file));
			fclose($fh);
			return $data;
		}
		return false;
	}
615089
public function getCommits($file = null)
    {
        $command = 'log --pretty=format:"<item><hash>%H</hash><short_hash>%h</short_hash><tree>%T</tree><parents>%P</parents><author>%an</author><author_email>%ae</author_email><date>%at</date><commiter>%cn</commiter><commiter_email>%ce</commiter_email><commiter_date>%ct</commiter_date><message><![CDATA[%s]]></message></item>"';

        if ($file) {
            $command .= " $file";
        }

        $logs = $this->getPrettyFormat($command);

        foreach ($logs as $log) {
            $commit = new Commit();
            $commit->importData($log);
            $commits[] = $commit;

            foreach ($this->statistics as $statistic) {
                $statistic->addCommit($commit);
            }
        }

        $this->setCommitsHaveBeenParsed(true);

        return $commits;
    }
422918
public static function highlightFile(string $file, int $line, int $lines = 15, array $vars = null): ?string
    {
        $source = @\file_get_contents($file); // @ file may not exist
        if ($source) {
            $source = static::highlightPhp($source, $line, $lines, $vars);
            if ($editor = Helpers::editorUri($file, $line)) {
                $source = \substr_replace($source, ' data-tracy-href="' . Helpers::escapeHtml($editor) . '"', 4, 0);
            }

            return $source;
        }

        return null;
    }
87618
public static function isFileEmpty($file)
    {
        if (!is_file($file)) {
            throw new RuntimeException(sprintf('Invalid file path supplied'));
        }

        return mb_strlen(file_get_contents($file, 2), 'UTF-8') > 0 ? false : true;
    }
654477
private function renderPHP($file, $line)
    {
        try {
            $count = count(file($file));
            $code  = highlight_file($file, true);
            return $this->wrapLineNumbers($count, $code, $line);
        }
        catch(Throwable $e) { // Error or Exception (executed only in PHP 7, will not match in PHP 5)
            return null;
        }
        catch(Exception $e) { // Once PHP 5 support is no longer needed, this block can be removed.
            return null;
        }
    }
812872
public function check($file)
    {
        $process = new Process('php -lf '.$file);
        $process->run();
        if (0===$process->getExitCode()) {
            return true;
        } else {
            //$this->logger->addFail('Check syntax failed <comment>'.$process->getOutput().'</comment>');
            throw new LinterException($this,$process->getOutput());
            //return false;
        }
    }