load text data
@throws \Exception
181304
private function load()
    {
        // reset phrases
        $this->phrases = array();
        $this->loaded = true;

        // set file path
        $langDataPath = FS2LANG . '/' . $this->local . '/' . $this->type . '.txt';

        // include language data file
        if (file_exists($langDataPath)) {
            // load file
            $langData = file_get_contents($langDataPath);
            $langData = str_replace(array("\r\n", "\r"), "\n", $langData); // unify linebreaks
            $this->import($langData);

            // get lines
            $langData = preg_replace("/#.*?\n/is", '', $langData);
            $langData = explode("\n", $langData);

            // Run through lines
            foreach ($langData as $line) {
                preg_match("#([a-z0-9_-]+?)\s*?:\s*(.*)#is", $line, $match);
                if (count($match) >= 2) {
                    $this->add($match[1], $match[2]);
                }
                unset($match);
            }
        } else {
            Throw new \Exception('Language File not found: ' . $langDataPath);
        }
    }
256466
private function loadParams() {
        if($this->getRequest()->getRawBody() == ''
            && empty($this->getRequest()->getPost())
            && empty($this->getRequest()->getPut())
            && empty($this->getRequest()->getUploadedFiles())
        ) {
            throw new Exception('No Data Passed', 400);
        }
        $bulkCreation = false;
        if(!is_null($this->getRequest()->getJsonRawBody())) {
            $params = $this->getRequest()->getJsonRawBody();
            $delimiter = '.';
            if(is_array($params)) {
                $bulkCreation = true;
            }
        } else {
            if($this->getRequest()->isPost()) {
                $params = $this->getRequest()->getPost();
            } else {
                $params = $this->getPut();
            }
            $delimiter = '_';
        }
        if($this->request->getRawBody()!='' && sizeOf($params) == 0 && json_last_error() != JSON_ERROR_NONE) {
            $this->dispatchJsonError();
        }
        if($bulkCreation) { //Bulk Creation
            $outputParams = [];
            foreach($params as $param) {
                $helper = new SplitHelper($delimiter);
                $outputParams[] = $helper->convert((array)$param);
            }
            $this->setParams($outputParams);
        } else {
            $helper = new SplitHelper($delimiter);
            $this->setParams($helper->convert((array)$params));
        }
    }
980401
public function loadData($name) {

        $file = sprintf('%s/../Resources/fixtures/%s.yml', __DIR__ , $name);
        if(!file_exists($file)) {
            throw new \Exception(sprintf('fixtures file "%s" not found for name "%s"', $file, $name));
        }

        $data = Yaml::parse($file);

        $items = [];
        foreach ($data as $args) {
            $item = $this->create($args);
            $this->manager->persist($item);
            $items[] = $item;
        }

        $this->manager->flush();
    }
213640
protected function loadData()
    {
        if (is_null($this->filteredData)) {
            $this->filteredData = $this->filterHelper->filterData(
                $this->data,
                $this->filters,
                FilterInterface::FILTER_LOGIC_OR
            );

            if (!is_null($this->sort)) {
                $sort = $this->sort;
                uasort($this->filteredData, function ($a, $b) use ($sort) {
                    if (is_numeric($a[$sort[0]])) {
                        $comp = ($a[$sort[0]] < $b[$sort[0]]) ? -1 : 1;
                    } else {
                        $comp = (strcmp($a[$sort[0]], $b[$sort[0]]));
                    }

                    if ($sort[1] == "DESC") {
                        return -1 * $comp;
                    } else {
                        return $comp;
                    }

                });
            }
        }
    }
1333714
protected function loadClasses(){
        if( ! is_dir( $this->srcDirectory)){
            throw new \Exception( 'Source directory not found : '. $this->srcDirectory);
        }

        $objects = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator( $this->srcDirectory), \RecursiveIteratorIterator::SELF_FIRST);
        $Regex = new \RegexIterator( $objects, '/^.+\.php$/i', \RecursiveRegexIterator::GET_MATCH);
        foreach( $Regex as $name => $object){
            if ( ! empty( $name)) {
                require_once $name;
            }
        }

        $classes    = get_declared_classes();
        $traits     = get_declared_traits();
        $interfaces = get_declared_interfaces();
        $this->loadedClasses = array_merge( $classes, $traits, $interfaces);
    }
1044368
def _load_text(handle, split=False, encoding="utf-8"):
    """"""
    string = handle.read().decode(encoding)
    return string.splitlines() if split else string
746412
protected function loadData()
    {

        $this->checkProperty('filename');


        // Ist Datei vorhanden
        if (!(new UrlValidation())->isUrl($this->filename)) {

            $file = new File($this->filename);
            if (!$file->exists()) {
                (new LogMessage())->writeError('File ' . $this->filename . ' does not exist.');
                return;
            }
        }

        //$count = 0;
        // falls Header, assocatives array
        $count = 0;
        $dataHeader = [];

        // Datei einlesen
        $file = fopen($this->filename, 'r');
        if ($file) {
            while (($line = fgets($file)) !== false) {

                // Utf8 Encode
                /* if ($this->utf8Encode) {
                     $line = utf8_encode($line);
                 }

                 if ($this->trimLine) {
                     $line = trim($line);
                 }*/


                if ($count >= $this->lineOfStart) {

                    $data = explode($this->separator, $line);


                    //(new Debug())->write($data);

                    //$this->addItem($data);


                    if ($this->useFirstRowAsHeader) {

                        if ($count == $this->lineOfStart) {

                            $dataHeader = array_map('trim', $data);

                        } else {


                            $dataNew = [];
                            //$rowCount = 0;
                            //foreach ($dataHeader as $rowHeader) {

                            foreach ($dataHeader as $key => $value) {
                                //$dataNew[trim($rowHeader)] = $data[$rowCount];
                                $dataNew[$value] = $data[$key];

                                //$rowCount++;
                            }

                            //$csvRow = new CsvRow($dataNew);
                            //$this->list[] = $dataNew;  // $csvRow;

                            $this->addItem($dataNew);

                        }
                    } else {
                        //$this->list[] = $data;  // new CsvRow($data);
                        $this->addItem($data);
                    }


                }

                $count++;


            }
            fclose($file);
        } else {
            (new LogMessage())->writeError('error opening the file.');
        }

    }
358321
protected function loadDatabaseConfig()
    {
        if (!$this->databaseConfigFile) {
            return null;
        }

        $configPath = "{$this->path}/{$this->databaseConfigFile}";
        if (file_exists($configPath)) {
            $this->databaseConfig = require $configPath;
        } else {
            throw new Exception("Unable to load database configuration.");
        }
    }
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;
    }
215418
protected function _loadRequestMethod()
    {
        if($this->_requestMethod !== NULL) return;

        if(!key_exists('REQUEST_METHOD', $_SERVER)) {
            throw new Exception("Request method unknown");
        }

        $method = strtoupper($_SERVER['REQUEST_METHOD']);

        if (in_array($method, array('GET', 'POST', 'PUT', 'DELETE', 'PATCH'))) {
            $this->_requestMethod = $method;
        } else {
            throw new Exception("Request method ($method) invalid");
        }
    }
189074
public function reload() : ISource
   {

      $this->_translations = [];
      $this->_categories   = null;

      if ( isset( $this->_options[ 'data' ] ) )
      {
         $this->_translations = $this->_options[ 'data' ];
      }

      if ( isset( $this->_options[ 'file' ] ) && \file_exists( $this->_options[ 'file' ] ) )
      {
         try
         {
            /** @noinspection PhpIncludeInspection */
            $translations = include $this->_options[ 'file' ];
         }
         catch ( \Throwable $ex )
         {
            throw new \Exception( 'Can not load the translations file "' . $this->_options[ 'file' ] .
                                  '! Not an valid ArraySource translation file.' );
         }
         if ( ! \is_array( $translations ) || \count( $translations ) < 1 )
         {
            throw new \Exception( 'Can not load the translations file "' . $this->_options[ 'file' ] .
                                  '! Not an valid ArraySource translation file.' );
         }
         if ( $this->_useNumericId )
         {
            foreach ( $translations as $identifier => $data )
            {
               if ( ! \is_int( $identifier ) )
               {
                  throw new \Exception( 'Can not load the translations file "' . $this->_options[ 'file' ] .
                                        '! The translation data do not use numeric identifiers.' );
               }
            }
         }
         else
         {
            foreach ( $translations as $identifier => $data )
            {
               if ( ! \is_string( $identifier ) )
               {
                  throw new \Exception( 'Can not load the translations file "' . $this->_options[ 'file' ] .
                                        '! The translation data do not use string identifiers.' );
               }
            }
         }

         $this->_translations = \array_merge( $this->_translations, $translations );

      }

      return $this;

   }
600302
public function parse(){
		while($this->parser->hasText()){
			if(!preg_match('/\s+(.+?):\s*((\s*(".+?"|[^"]+?)\s*)(\s*,\s*(".+?"|[^"]+?)\s*)*)((;\s*})|(;|\}))/is', $this->parser->getText(), $matches)) throw new \Exception("Invalid property at '".substr($this->parser->getText(), 0, 20)."'");
			$this->parser->move(strlen($matches[0]));
			
			$this->propertySet->setProperty($matches[1], $matches[2]);
			
			if(strpos(end($matches), '}')) break;
		}
	}
1097770
public function loadMessages()
    {
        $message = new IncomingMessage(File::PATTERN, $this->event->get('from')['id'], $this->event->get('chat')['id'],
            $this->event);
        $message->setFiles($this->getFiles());

        $this->messages = [$message];
    }
402953
public function parseText() : void
    {
        if (!count($this->stream->getTokens())) {
            return;
        }

        if ($this->accept(Token::T_TEXT)) {
            $this->insert(new TextNode($this->getCurrentToken()->getValue()));
            $this->advance();
        }
    }
541602
public function readLine(): string
	{
		if ($this->connected() === false)
		{
			throw new \Exception('Not connected');
		}

		$response = fgets($this->connection);

		if ($response === false)
		{
			throw new \Exception('Nothing to read');
		}

		return $response;
	}
203545
protected function load()
    {
        $json = file_get_contents($this->filename);
        if (false === $json) {
            // @codeCoverageIgnoreStart
            throw new RuntimeException('Unable to open file ' . $this->filename);
            // @codeCoverageIgnoreEnd
        }

        $this->unserialize($json);
        $this->cookies = $this->cookies ?: array();
    }
1340582
public function load(): ResponseInterface
    {
        if (false === mb_strpos($this->file, '://')) {
            if (!is_file($this->file)) {
                throw new Exception('The given local file [' . $this->file . '] is not a file', Exception::LOCAL_FILE_NOT_READABLE);
            }

            if (!is_readable($this->file)) {
                throw new Exception('The given local file [' . $this->file . '] is not readable', Exception::LOCAL_FILE_NOT_READABLE);
            }
        }

        $stream = fopen($this->file, 'rb', false);

        if (false === $stream) {
            throw new Exception('could not read content from the given local file  [' . $this->file . ']', Exception::LOCAL_FILE_NOT_READABLE);
        }

        return new Response(200, [], new Stream($stream));
    }