@param string $php
PHP code read from a file.

@return \Donquixote\HastyPhpAst\Ast\File\AstFileInterface|null
540630
function phpGetAst($php) {

    $tokens = token_get_all($php);
    $tokens[] = '#';
    $i = 0;

    try {
      $fileAst = $this->parser->parse($tokens, $i);
    }
    catch (ParseError $e) {
      return NULL;
    }

    if (!$fileAst instanceof AstFileInterface) {
      return NULL;
    }

    return $fileAst;
  }
171641
public function read($length = null)
    {
        $this->_ensureReadable();
        $length = $this->_bufferSize($length);
        if ($length <= 0) {
            return '';
        }
        $result = fread($this->_resource, $length);
        return $result === false ? '' : $result;
    }
83343
public function get($key)
	{
		$hash = md5($key);
		$cacheFile = $this->getPath().'/'.$hash.'.cache';

		if (!is_file($cacheFile)) {
			return null;
		}
		return unserialize(file_get_contents($cacheFile));
	}
348552
public function eof()
	{
		if (!$this->fh)
		{
			throw new \RuntimeException('File not open');
		}

		// Capture PHP errors
		$php_errormsg = '';
		$track_errors = ini_get('track_errors');
		ini_set('track_errors', true);

		switch ($this->processingmethod)
		{
			case 'gz':
				$res = gzeof($this->fh);
				break;

			case 'bz':
			case 'f':
			default:
				$res = feof($this->fh);
				break;
		}

		if ($php_errormsg)
		{
			throw new \RuntimeException($php_errormsg);
		}

		// Restore error tracking to what it was before
		ini_set('track_errors', $track_errors);

		// Return the result
		return $res;
	}
208396
public function readResultFile($sOutputKey = null)
    {
        $sCurrentKey = (empty($sOutputKey)) ? $this->_sOutputKey : $sOutputKey;

        return $this->_oUtils->fromFileCache($sCurrentKey);
    }
356415
public function load(string $file)
    {
        $file = $this->sanitizeFileName($file);
        if (empty($this->loaded)
            && !empty($this->beforeFirstTimeLoadCallBack)
            && $this->isValid()
        ) {
            $callback = $this->beforeFirstTimeLoadCallBack;
            $callback($this);
            $this->beforeFirstTimeLoadCallBack = false;
        }

        $this->loaded[$file] = isset($this->loaded[$file])
            ? $this->loaded[$file]+1
            : 1;
        return RequireBinding::with(($this->getThemePath() . $file), $this);
    }
52216
public static String readFile(String string) {
		InputStream inputStream = getInputStream(string);
		if (inputStream != null) {
			return new String(readStream(inputStream));
		}
		return null;
	}
585945
public function offsetGet($offset)
    {
        $index = $this->findLine($offset);

        if ($index > 0) {
            $parsedKey   = null;
            $parsedValue = null;

            $parseOk = $this->parseEnvLine($this->lines[$index], $parsedKey, $parsedValue);

            return $parseOk ? $parsedValue : null;
        }

        return null;
    }
1023131
protected function _getFile($file, $content = null) {
		$_SERVER['argv'] = [];

		$phpcs = new Runner();

		if (!defined('PHP_CODESNIFFER_CBF')) {
			define('PHP_CODESNIFFER_CBF', false);
		}
		// Explictly specifying standard prevents it from searching for phpcs.xml type files.
		$config = new Config(['--standard=PSR2']);
		$phpcs->config = $config;
		$phpcs->init();

		$ruleset = new Ruleset($config);

		$fileObject = new File($file, $ruleset, $config);
		$fileObject->setContent($content !== null ? $content : file_get_contents($file));
		$fileObject->parse();

		return $fileObject;
	}
368753
static function read($file)
	{
		if(file_exists($file) && is_readable($file))
			return file_get_contents($file);

		foreach(bors_dirs() as $dir)
			if(file_exists($fn = $dir.'/data/'.$file) && is_readable($fn))
				return file_get_contents($fn);

		return NULL;
	}
222956
static function readFile($file, $exclusive = false)
    {
        $fp = fopen($file, 'r');
        if (!$fp)
        {
            return false;
        }
        $lockType = $exclusive ? LOCK_EX : LOCK_SH;
        if (flock($fp, $lockType) === false)
        {
            fclose($fp);
        }
        $content = '';
        while(!feof($fp))
        {
            $content .= fread($fp, 8192);
        }
        flock($fp, LOCK_UN);
        return $content;
    }
899009
public function getHeader($code)
    {
        if (isset($this->headers[$code])) {
            return $this->headers[$code];
        }

        return null;
    }
510649
public function getFile($file = null, $md5 = null)
    {
        //====================================================================//
        // Stack Trace
        Splash::log()->trace();

        //====================================================================//
        // PHPUNIT Exception => Look First in Local FileSystem
        //====================================================================//
        if (defined('SPLASH_DEBUG') && !empty(SPLASH_DEBUG)) {
            $filePath = dirname(__DIR__)."/Resources/files/".$file;
            if (is_file($filePath)) {
                $file = $this->readFile($filePath, $md5);

                return is_array($file) ? $file : false;
            }
            $imgPath = dirname(__DIR__)."/Resources/img/".$file;
            if (is_file($imgPath)) {
                $file = $this->readFile($imgPath, $md5);

                return is_array($file) ? $file : false;
            }
        }

        //====================================================================//
        // Initiate Tasks parameters array
        $params = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
        $params->file = $file;
        $params->md5 = $md5;
        //====================================================================//
        // Add Task to Ws Task List
        Splash::ws()->addTask(SPL_F_GETFILE, $params, Splash::trans("MsgSchRemoteReadFile", (string) $file));

        //====================================================================//
        // Execute Task
        $response = Splash::ws()->call(SPL_S_FILE);

        //====================================================================//
        // Return First Task Result
        return Splash::ws()->getNextResult($response);
    }
579909
private function handle($request)
    {
        $found = $this->fileMap->render($request->getPathToMatch());
        if (empty($found)) {
            return null;
        }
        if (is_resource($found[0])) {
            return $request->respond()->asFileContents($found[0], $found[1]);
        }
        if (is_string($found[0])) {
            return $request->respond()->asContents($found[0]);
        }
        return null;
    }
102646
protected function parseFileID($fileID)
    {
        /** @var ParsedFileID $parsedFileID */
        $parsedFileID = $this->getProtectedResolutionStrategy()->parseFileID($fileID);
        return $parsedFileID ? $parsedFileID->getTuple() : null;
    }
99902
public function gets($length = 0)
	{
		if (!$this->fh)
		{
			throw new \RuntimeException('File not open');
		}

		// Capture PHP errors
		$php_errormsg = 'Error Unknown';
		$track_errors = ini_get('track_errors');
		ini_set('track_errors', true);

		switch ($this->processingmethod)
		{
			case 'gz':
				$res = $length ? gzgets($this->fh, $length) : gzgets($this->fh);
				break;

			case 'bz':
			case 'f':
			default:
				$res = $length ? fgets($this->fh, $length) : fgets($this->fh);
				break;
		}

		if (!$res)
		{
			throw new \RuntimeException($php_errormsg);
		}

		// Restore error tracking to what it was before
		ini_set('track_errors', $track_errors);

		// Return the result
		return $res;
	}
1026498
public function get( $key )
	{
		$uri		= $this->getUriForKey( $key );
		if( !$this->isValidFile( $uri ) )
			return NULL;
		if( isset( $this->data[$key] ) )
			return $this->data[$key];
		$content	= FS_File_Editor::load( $uri );
		$value		= unserialize( $content );
		$this->data[$key]	= $value;
		return $value;
	}