Constructs the reader, loading parsed data from cache if available.

@return void
439901
public function initializeObject()
    {
        if ($this->cache->has('fractions')) {
            $this->fractions = $this->cache->get('fractions');
        } else {
            $this->generateFractions();
            $this->cache->set('fractions', $this->fractions);
        }
    }
1053075
final public function reading() : void
    {
        swoole_event_add($this->backend->process()->pipe, function () {
            $recv = $this->backend->process()->read();
            try {
                list($name, $arguments) = unserialize($recv);
                $this->backend->$name(...$arguments);
            } catch (Throwable $e) {
                logger('process')->notice('Dispatch failed', ['err' => get_class($e), 'msg' => $e->getMessage()]);
            }
        });
    }
359323
protected function loadBuffer()
	{
		$this->buffer = '';
	
		if($this->finished)
		{
			return;
		}
		
		while(!$this->stream->eof() && strlen($this->buffer) < $this->chunkSize)
		{
			$this->buffer .= $this->stream->read($this->chunkSize - strlen($this->buffer));
		}
		
		if($this->buffer === '')
		{
			$this->finished = true;
			$this->buffer .= "0\r\n\r\n";
		}
		else
		{
			$this->buffer = sprintf("%X\r\n%s\r\n", strlen($this->buffer), $this->buffer);
		}
	}
359598
protected function load()
	{
		$this->rules = [];
		$rules = DiscHelper::loadFromFile($this->ruleFile);
		foreach ($rules as $name => $ruleData) {
			$this->rules[$name] = unserialize($ruleData);
		}
	}
1150437
protected function init()
    {
        $structure = $this->imapFetchstructure();
        $this->structure = $structure;
        if (isset($structure->parts)) {
            $countSection = count($structure->parts);
            $this->countAttachment = $countSection - 1;
        }
        $this->getCountSection();
        $this->getHeader();
        $this->getAttachments();
        $this->getBody();
        if ($this->_decode === self::DECODE) {
            $this->decode();
        }
    }
606603
public function read()
    {
        $data = @fread($this->stream, 30000);

        if($data === false) return;
        $this->buffer .= $data;

        if(!is_null($this->status)) return;
        if(strlen($this->buffer) < 4) return;
        $end = strpos($this->buffer, "\r\n\r\n", 4);
        if($end === false) return;

        list($request, $headers) = $this->parse_header(substr($this->buffer, 0, $end));
        list($version, $status, $phrase) = explode(' ', $request, 3);
        $this->status = $status;
        $this->response_length = isset($headers['content-length'])? (int)$headers['content-length'][0] : 0;
    }
38353
protected function readFrame(): void
    {
        $header = $this->forceRead(8);

        if (\strlen($header) < 8) {
            return;
        }

        $decoded = \unpack('C1type/C3/N1size', $header);
        $output = $this->forceRead($decoded['size']);
        $callbackList = [];

        if (0 === $decoded['type']) {
            $callbackList = $this->onStdinCallables;
        }

        if (1 === $decoded['type']) {
            $callbackList = $this->onStdoutCallables;
        }

        if (2 === $decoded['type']) {
            $callbackList = $this->onStderrCallables;
        }

        foreach ($callbackList as $callback) {
            $callback($output);
        }
    }
1073131
public function load()
    {
        $contents = $this->repository->get($this->key);

        if (! is_null($contents)) {
            $this->setFromStorage($contents);
        }
    }
222305
public function handleRead()
    {
        try
        {
            if (!$this->reading)
            {
                return;
            }

            $length = $this->bufferSize;
            $ret = fread($this->resource, $length);

            if ($ret === false)
            {
                $this->emit('error', [ $this, new ReadException('Error occurred while reading from the stream resource.') ]);
                return;
            }

            if ($ret !== '')
            {
                $this->emit('data', [ $this, $ret ]);

                if (strlen($ret) < $length)
                {
                    $this->reading = false;
                    $this->emit('end', [ $this ]);
                }
            }
        }
        catch (Error $ex)
        {
            $this->emit('error', [ $this, $ex ]);
        }
        catch (Exception $ex)
        {
            $this->emit('error', [ $this, $ex ]);
        }
    }
347703
public function onRead()
    {
        $seq = ["\xff\xf4\xff\xfd\x06", "\xff\xec", "\x03", "\x04"];
        $finish = false;
        foreach ($seq as $s) {
            if ($this->search($s) !== false) {
                $finish = true;
            }
        }
        while (($line = $this->readline()) !== null) {
            $line = rtrim($line, "\r\n");
            $e = explode(' ', $line, 2);
            $cmd = trim(strtolower($e[0]));
            $arg = isset($e[1]) ? $e[1] : '';

            if ($cmd === 'quit' || $cmd === 'exit') {
                $this->disconnect();
            } elseif (!$this->auth) {
                $this->checkPassword($line);
            } else {
                $this->processCommand($cmd, $arg);
            }
        }

        if ($finish) {
            $this->finish();
        }
    }
1103457
private function build_parse_cache()
    {
        // cache symbol regexp
        //As this is a costy operation, we avoid doing it for multiple groups ...
        //Instead we perform it for all symbols at once.
        //
        //For this to work, we need to reorganize the data arrays.
        if ($this->lexic_permissions['SYMBOLS'] && !empty($this->language_data['SYMBOLS'])) {
            $this->language_data['MULTIPLE_SYMBOL_GROUPS'] = count($this->language_data['STYLES']['SYMBOLS']) > 1;

            $this->language_data['SYMBOL_DATA'] = [];
            $symbol_preg_multi = []; // multi char symbols
            $symbol_preg_single = []; // single char symbols
            foreach ($this->language_data['SYMBOLS'] as $key => $symbols) {
                if (is_array($symbols)) {
                    foreach ($symbols as $sym) {
                        $sym = $this->hsc($sym);
                        if (!isset($this->language_data['SYMBOL_DATA'][$sym])) {
                            $this->language_data['SYMBOL_DATA'][$sym] = $key;
                            if (isset($sym[1])) { // multiple chars
                                $symbol_preg_multi[] = preg_quote($sym, '/');
                            }
                            else { // single char
                                if ($sym == '-') {
                                    // don't trigger range out of order error
                                    $symbol_preg_single[] = '\-';
                                }
                                else {
                                    $symbol_preg_single[] = preg_quote($sym, '/');
                                }
                            }
                        }
                    }
                }
                else {
                    $symbols = $this->hsc($symbols);
                    if (!isset($this->language_data['SYMBOL_DATA'][$symbols])) {
                        $this->language_data['SYMBOL_DATA'][$symbols] = 0;
                        if (isset($symbols[1])) { // multiple chars
                            $symbol_preg_multi[] = preg_quote($symbols, '/');
                        }
                        elseif ($symbols == '-') {
                            // don't trigger range out of order error
                            $symbol_preg_single[] = '\-';
                        }
                        else { // single char
                            $symbol_preg_single[] = preg_quote($symbols, '/');
                        }
                    }
                }
            }

            //Now we have an array with each possible symbol as the key and the style as the actual data.
            //This way we can set the correct style just the moment we highlight ...
            //
            //Now we need to rewrite our array to get a search string that
            $symbol_preg = [];
            if (!empty($symbol_preg_multi)) {
                rsort($symbol_preg_multi);
                $symbol_preg[] = implode('|', $symbol_preg_multi);
            }
            if (!empty($symbol_preg_single)) {
                rsort($symbol_preg_single);
                $symbol_preg[] = '[' . implode('', $symbol_preg_single) . ']';
            }
            $this->language_data['SYMBOL_SEARCH'] = implode("|", $symbol_preg);
        }

        // cache optimized regexp for keyword matching
        // remove old cache
        $this->language_data['CACHED_KEYWORD_LISTS'] = [];
        foreach (array_keys($this->language_data['KEYWORDS']) as $key) {
            if (!isset($this->lexic_permissions['KEYWORDS'][$key]) ||
                $this->lexic_permissions['KEYWORDS'][$key]
            ) {
                $this->optimize_keyword_group($key);
            }
        }

        // brackets
        if ($this->lexic_permissions['BRACKETS']) {
            $this->language_data['CACHE_BRACKET_MATCH'] = ['[', ']', '(', ')', '{', '}'];
            if (!$this->use_classes && isset($this->language_data['STYLES']['BRACKETS'][0])) {
                $this->language_data['CACHE_BRACKET_REPLACE'] = [
                    '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#91;|>',
                    '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#93;|>',
                    '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#40;|>',
                    '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#41;|>',
                    '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#123;|>',
                    '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#125;|>',
                ];
            }
            else {
                $this->language_data['CACHE_BRACKET_REPLACE'] = [
                    '<| class="br0">&#91;|>',
                    '<| class="br0">&#93;|>',
                    '<| class="br0">&#40;|>',
                    '<| class="br0">&#41;|>',
                    '<| class="br0">&#123;|>',
                    '<| class="br0">&#125;|>',
                ];
            }
        }

        //Build the parse cache needed to highlight numbers appropriate
        if ($this->lexic_permissions['NUMBERS']) {
            //Check if the style rearrangements have been processed ...
            //This also does some preprocessing to check which style groups are useable ...
            if (!isset($this->language_data['NUMBERS_CACHE'])) {
                $this->build_style_cache();
            }

            //Number format specification
            //All this formats are matched case-insensitively!
            static $numbers_format = [
                self::NUMBER_INT_BASIC          =>
                    '(?:(?<![0-9a-z_\.%$@])|(?<=\.\.))(?<![\d\.]e[+\-])([1-9]\d*?|0)(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
                self::NUMBER_INT_CSTYLE         =>
                    '(?<![0-9a-z_\.%])(?<![\d\.]e[+\-])([1-9]\d*?|0)l(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
                self::NUMBER_BIN_SUFFIX         =>
                    '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])[01]+?[bB](?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
                self::NUMBER_BIN_PREFIX_PERCENT =>
                    '(?<![0-9a-z_\.%])(?<![\d\.]e[+\-])%[01]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
                self::NUMBER_BIN_PREFIX_0B      =>
                    '(?<![0-9a-z_\.%])(?<![\d\.]e[+\-])0b[01]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
                self::NUMBER_OCT_PREFIX         =>
                    '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])0[0-7]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
                self::NUMBER_OCT_PREFIX_0O      =>
                    '(?<![0-9a-z_\.%])(?<![\d\.]e[+\-])0o[0-7]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
                self::NUMBER_OCT_PREFIX_AT      =>
                    '(?<![0-9a-z_\.%])(?<![\d\.]e[+\-])\@[0-7]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
                self::NUMBER_OCT_SUFFIX         =>
                    '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])[0-7]+?o(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
                self::NUMBER_HEX_PREFIX         =>
                    '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])0x[0-9a-fA-F]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
                self::NUMBER_HEX_PREFIX_DOLLAR  =>
                    '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])\$[0-9a-fA-F]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
                self::NUMBER_HEX_SUFFIX         =>
                    '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])\d[0-9a-fA-F]*?[hH](?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
                self::NUMBER_FLT_NONSCI         =>
                    '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])\d+?\.\d+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
                self::NUMBER_FLT_NONSCI_F       =>
                    '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])(?:\d+?(?:\.\d*?)?|\.\d+?)f(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
                self::NUMBER_FLT_SCI_SHORT      =>
                    '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])\.\d+?(?:e[+\-]?\d+?)?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
                self::NUMBER_FLT_SCI_ZERO       =>
                    '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])(?:\d+?(?:\.\d*?)?|\.\d+?)(?:e[+\-]?\d+?)?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
            ];

            //At this step we have an associative array with flag groups for a
            //specific style or an string denoting a regexp given its index.
            $this->language_data['NUMBERS_RXCACHE'] = [];
            foreach ($this->language_data['NUMBERS_CACHE'] as $key => $rxdata) {
                if (is_string($rxdata)) {
                    $regexp = $rxdata;
                }
                else {
                    //This is a bitfield of number flags to highlight:
                    //Build an array, implode them together and make this the actual RX
                    $rxuse = [];
                    for ($i = 1; $i <= $rxdata; $i <<= 1) {
                        if ($rxdata & $i) {
                            $rxuse[] = $numbers_format[$i];
                        }
                    }
                    $regexp = implode("|", $rxuse);
                }

                $this->language_data['NUMBERS_RXCACHE'][$key] =
                    "/(?<!<\|\/)(?<!<\|!REG3XP)(?<!<\|\/NUM!)(?<!\d\/>)($regexp)(?!(?:<DOT>|(?>[^\<]))+>)(?![^<]*>)(?!\|>)(?!\/>)/i"; //
            }

            if (!isset($this->language_data['PARSER_CONTROL']['NUMBERS']['PRECHECK_RX'])) {
                $this->language_data['PARSER_CONTROL']['NUMBERS']['PRECHECK_RX'] = '#\d#';
            }
        }

        $this->parse_cache_built = true;
    }
144875
public function parse()
    {
        /*
         * If the object has already been parsed in this request return the cached data.
         */
        if (array_key_exists($this->filePath, self::$cache)) {
            self::$cache[$this->filePath]['source'] = 'request-cache';
            return self::$cache[$this->filePath];
        }

        /*
         * Try to load the parsed data from the cache
         */
        $path = $this->getCacheFilePath();

        $result = [
            'filePath' => $path,
            'className' => null,
            'source' => null,
            'offset' => 0
        ];

        /*
         * There are two types of possible caching scenarios, either stored
         * in the cache itself, or stored as a cache file. In both cases,
         * make sure the cache is not stale and use it.
         */
        if (is_file($path)) {
            $cachedInfo = $this->getCachedFileInfo();
            $hasCache = $cachedInfo !== null;

            /*
             * Valid cache, return result
             */
            if ($hasCache && $cachedInfo['mtime'] == $this->object->mtime) {
                $result['className'] = $cachedInfo['className'];
                $result['source'] = 'cache';

                return self::$cache[$this->filePath] = $result;
            }

            /*
             * Cache expired, cache file not stale, refresh cache and return result
             */
            if (!$hasCache && filemtime($path) >= $this->object->mtime) {
                $className = $this->extractClassFromFile($path);
                if ($className) {
                    $result['className'] = $className;
                    $result['source'] = 'file-cache';

                    $this->storeCachedInfo($result);
                    return $result;
                }
            }
        }

        $result['className'] = $this->rebuild($path);
        $result['source'] = 'parser';

        $this->storeCachedInfo($result);
        return $result;
    }
101253
protected function registerReader()
    {
        // Give a Cached Reader when our
        // reader class needs
        // a ReaderContract.
        $this->app->when(AnnotationsReader::class)
                  ->needs(Reader::class)
                  ->give(function () {
                      return $this->createAndReturnCachedReader();
                  });
    }
169159
private function load()
    {
        $filename = $this->path . '/domainparsertld.txt';

        if (file_exists($filename)) {
            $this->tldList = unserialize(file_get_contents($filename));

            // will reload tld list if timestamp of cache file is outdated
            if (time() - $this->tldList['timestamp'] > $this->cacheTime) {
                $this->reload = true;
            }

            // will reload tld list if changes to Additional.php have been made
            if ($this->tldList['timestamp'] < filemtime(__DIR__ .'/Additional.php')) {
                $this->reload = true;
            }
        }

        // check connection - if there is no internet connection skip loading
        $existFile = file_exists($filename);

        if (! $existFile || $this->reload === true) {
            $this->catchTlds($existFile);
            $file = fopen($filename, 'w+');

            if ($file === false) {
                throw AbstractException::factory('OpenFile', 'Could not open cache file.');
            }

            if (fwrite($file, serialize($this->tldList)) === false) {
                throw AbstractException::factory('WriteFile', 'Could not open cache file for writing.');
            }

            fclose($file);
        }

        $this->loaded = true;
    }
877761
public function load()
    {
        // Create new Reader
        if ($this->classname === null) {
            throw new BuildException("No Classname given to TokenSource.");
        }

        $classname = Phing::import($this->classname);
        $this->reader = new $classname($this->project);

        // Configure Reader
        $this->configureTokenReader($this->reader);

        // Load Tokens
        try {
            while ($token = $this->reader->readToken()) {
                $this->tokens[] = $token;
            }
        } catch (BuildException $e) {
            $this->log("Error reading TokenSource: " . $e->getMessage(), Project::MSG_WARN);
        } catch (IOException $e) {
            $this->log("Error reading TokenSource: " . $e->getMessage(), Project::MSG_WARN);
        }
    }
202558
public function initializeObject()
    {
        if ($this->cache->has('parsedFormats') && $this->cache->has('parsedFormatsIndices') && $this->cache->has('localizedSymbols')) {
            $this->parsedFormats = $this->cache->get('parsedFormats');
            $this->parsedFormatsIndices = $this->cache->get('parsedFormatsIndices');
            $this->localizedSymbols = $this->cache->get('localizedSymbols');
        }
    }
275580
private function load()
    {

        $this->initialize();
        $this->dataConnector->loadResourceLinkShareKey($this);
        if (!is_null($this->id)) {
            $this->length = strlen($this->id);
        }
        if (!is_null($this->expires)) {
            $this->life = ($this->expires - time()) / 60 / 60;
        }

    }