Returns all object by reading the reader to its end.
@param DBInterfaces\IDatabaseReader $reader
@return array DatabaseObject
770754
final function FetchFromReader(DBInterfaces\IDatabaseReader $reader)
    {
        $objects = array();
        while($reader->Read())
        {
            $object = $this->CreateInstance($reader->ByName($this->KeyField()));
            $object->InitFromReader($reader);
            $objects[] = $object;
        }
        $reader->Close();
        return $objects;
    }
664293
public function getUnreadMessages($read = true) {
        $emails = [];
        $result = imap_search($this->imap, 'UNSEEN');
        if(!$result){
            throw new ImapClientException('No read messages were found.');
        };
        $ids = ''; $countId = count($result);
        foreach($result as $key=>$id) {
            $emails[]= $this->getMessage($id);
            if(($countId-1) == $key){
                $ids .= $id;
            }else{
                $ids .= $id.',';
            };
        }
        /* Set flag UNSEEN */
        if(!$read){
            $this->setUnseenMessage($ids);
        }else{
            $this->setSeenMessage($ids);
        };
        return $emails;
    }
418618
private function parseXML(ProtectedXMLReader $reader)
	{
		$d = $reader->depth();
		while($reader->read($d))
		{
			if($reader->isElement(self::XML_META))
			{
				$metaD = $reader->depth();
				while($reader->read($metaD))
				{
					if($reader->isElement(self::XML_HEADERHASH))
						$this->_headerHash = base64_decode($reader->readTextInside());
					elseif($reader->isElement(self::XML_DATABASENAME))
						$this->_name = $reader->readTextInside();
					elseif($reader->isElement(self::XML_CUSTOMICONS))
					{
						$iconsD = $reader->depth();
						while($reader->read($iconsD))
						{
							if($reader->isElement(self::XML_ICON))
								$this->parseCustomIcon($reader);
						}
					}
				}
			}
			elseif($reader->isElement(self::XML_ROOT))
			{
				$rootD = $reader->depth();
				while($reader->read($rootD))
				{
					if($reader->isElement(self::XML_GROUP))
						$this->addGroup(Group::loadFromXML($reader));
				}
			}
		}
	}
451885
public function load(ReaderInterface $reader)
    {
        $this->configuration = $reader->getConfiguration();
        require_once $this->configuration->getDsl();

        $peridotCallback = include $this->configuration->getConfigurationFile();
        if (is_callable($peridotCallback)) {
            call_user_func($peridotCallback, $this->emitter);
        }
    }
1134136
public function all()
    {
        try {
            return $this->model->all(['name', 'value'])->pluck('value', 'name')->map(function ($value, $name) {
                return $this->castSetting($name, $value);
            })->toArray();
        } catch (Exception $e) {
            throw new ReadException($e);
        }
    }
707722
public function getAll(LibraryType $library, string $dir = '/')
    {
        $clippedBaseUri = $this->clipUri($this->client->getConfig('base_uri'));

        $response = $this->client->request(
            'GET',
            $clippedBaseUri . '/repos/' . $library->id . '/dir/',
            [
                'query' => ['p' => $dir],
            ]
        );

        $json = json_decode((string)$response->getBody());

        $dirItemCollection = [];

        foreach ($json as $dirItemJson) {
            $dirItem = (new DirectoryItem)->fromJson($dirItemJson);

            // if dirItem has no value for "dir", set it here
            if ($dirItem->dir === '/') {
                $dirItem = $dirItem->fromArray(['dir' => $dir]);
            }

            $dirItemCollection[] = $dirItem;
        }

        return $dirItemCollection;
    }
528332
private function loadAllObjects(): array
    {
        if (!file_exists($this->databaseFilePath)) {
            return [];
        }

        $objects = Serializer::deserialize("{$this->className}[]", file_get_contents($this->databaseFilePath));

        Assertion::allIsInstanceOf($objects, $this->className);

        return $objects;
    }
1022366
protected function loadModelTables()
    {
        $reader = $this->getModelReader();
        $tables = [];

        while ($reader->read()) {
            if ($reader->isModelTable()) {
                if ($table = $this->loadModelTable($reader->expand())) {
                    $tables[$table->getId()] = $table;
                } // if
            } // if
        } // while

        return $tables;
    }
742456
public function current()
    {
        $leftRow = $this->leftReader->current();

        if (array_key_exists($this->nestKey, $leftRow)) {
            throw new ReaderException(
                sprintf(
                    'Left Row: "%s" Reader already contains a field named "%s". Please choose a different nest key field',
                    $this->key(),
                    $this->nestKey
                )
            );
        }
        $leftRow[$this->nestKey] = [];

        $leftId     = $this->getRowId($leftRow, $this->leftJoinField);
        $rightRow   = $this->rightReader->current();
        $rightId    = $this->getRowId($rightRow, $this->rightJoinField);

        while ($leftId == $rightId && $this->rightReader->valid()) {

            $leftRow[$this->nestKey][] = $rightRow;
            $this->rightReader->next();

            $rightRow = $this->rightReader->current();

            if($this->rightReader->valid()) {
                $rightId = $this->getRowId($rightRow, $this->rightJoinField);
            }
        }

        return $leftRow;
    }
561853
public function get_readers($interface = null) {
        $this->init();
        $return = array();
        foreach ($this->readers as $plugin => $reader) {
            if (empty($interface) || ($reader instanceof $interface)) {
                $return[$plugin] = $reader;
            }
        }

        return $return;
    }
643123
protected function getReadOnlyTraitHooks(): array
	{
		return
		[
			'beforeInsert' =>
			[
				function($values, $query): void
				{
					throw new ReadOnlyException('Attempted to create a read-only record.');
				},
			],
			'beforeUpdate' =>
			[
				function($values, $query): void
				{
					throw new ReadOnlyException('Attempted to update a read-only record.');
				},
			],
			'beforeDelete' =>
			[
				function($query): void
				{
					throw new ReadOnlyException('Attempted to delete a read-only record.');
				},
			],
		];
	}
625489
public function getRead() {
        $Model = $this->Model;
        $parentKey = $this->model->getParentKey();
        $query = $this->baseQuery();
        $table = $this->model->getTable();
        $primary = $this->model->getKeyName();

        if ( $parentKey && Input::has($parentKey) ) {
            $parentValue = Input::get($parentKey);
            $query = $query->where("$table.$parentKey", $parentValue);
        }

        //Get single record by primary key
        if ( $id = $this->getKeyFromInput() ) {
            $record = $query->where("$table.$primary", $id)->first();
            if ( $record !== null ) {
                return $this->success($record);
            } else {
                return $this->failure($record, "$Model not found.");
            }
        }
        //Get multiple records (pagination)
        $filter = Input::get('filter');
        $limit =  Input::get('limit');
        $offset = Input::get('start');
        $lookup_query = Input::get('query');

        if ($lookup_query) {
            $this->filterQuery($query, array($this->model->queryParam => $lookup_query));
        }

        if ( $filter ) {
            $filters = json_decode($filter);
            $filter_dict = array();
            foreach($filters as $filter) {
                $filter_dict[$filter->property] = $filter->value;
            }
            $this->filterQuery($query, $filter_dict);
        }

        $count = $query->count();

        if ( $limit ) {
            $query->take($limit);
            if ( $offset ) {
                $query->skip($offset);
            }
        }

        if (Input::has('sort')) {
            $sorters = json_decode(Input::get('sort'));

            foreach($sorters as $sorter) {
                $query->orderBy($sorter->property, $sorter->direction);
            }
        }

        $records = $query->get();

        return $this->success($records, array('total' => $count));
    }
626777
private function fetchByIdentifier(array $directReads, SalesChannelContext $context): array
    {
        $entities = [];

        foreach ($directReads as $definitionClass => $ids) {
            $definition = $this->definitionRegistry->get($definitionClass);

            $repository = $this->getSalesChannelApiRepository($definition);

            if ($repository) {
                $entities[$definitionClass] = $repository->search(new Criteria($ids), $context);
            } else {
                $repository = $this->getApiRepository($definition);
                $entities[$definitionClass] = $repository->search(new Criteria($ids), $context->getContext());
            }
        }

        return $entities;
    }
785483
public function getReader($reInitiate = false) : ReaderInterface
    {
        if ($reInitiate === true || $this->reader === null) {
            $directory = $this->getDataDirectory();

            if (!$this->isDirectoryReadable($directory)) {
                throw new ParserConfigurationException("Directory '$directory' is not readable.", 1458974128);
            }

            $this->reader = new Reader($directory);
            $this->reader->setPropertyFilter($this->getPropertyFilter());
            $this->reader->setDataVersionHash($this->getDataVersionHash());
        }

        return $this->reader;
    }
202239
public function fetchAll($returnType = Table::RETURN_MODEL) {
        $return = $this->select(array(), $returnType);
        if (is_a($return, 'DBScribe\Table')) $return = $return->execute();
        if (is_bool($return)) return new ArrayCollection();

        return $return;
    }
492107
public function getAll()
    {
        $db = new DB();
        $result = $db->db()->select(['db_name'=>__config()->auth->db_name, 'table'=>__config()->auth->db_table]);
        $db->db()->close();

        return $result;
    }
1247968
protected function parseArrayElements(\XMLReader $reader, $elementName, $currentNodeIdentifier)
    {
        $values = [];
        $depth = 0;

        // The following silences static code analysis warnings about undefined variables.
        // during runtime this doesn't happen, because the $reader must be at an ELEMENT,
        // thus the variables would be defined in the first case block before they can be
        // used.
        $currentType = null;
        $currentEncoding = null;
        $currentClassName = null;
        $currentIdentifier = null;

        do {
            switch ($reader->nodeType) {
                case \XMLReader::ELEMENT:
                    $depth++;
                    // __type="object" __classname="Neos\Media\Domain\Model\ImageVariant" __encoding="json"
                    $currentType = $reader->getAttribute('__type');
                    $currentClassName = $reader->getAttribute('__classname');
                    $currentEncoding = $reader->getAttribute('__encoding');
                    break;
                case \XMLReader::END_ELEMENT:
                    if ($reader->name === $elementName) {
                        return $values;
                    }
                    break;
                case \XMLReader::CDATA:
                case \XMLReader::TEXT:
                    $values[] = $this->convertElementToValue($reader, $currentType, $currentEncoding, $currentClassName, $currentNodeIdentifier, $elementName);
                    break;
            }
        } while ($reader->read());
    }