@param LoopResult $loopResult

@return LoopResult
772611
public function parseResults(LoopResult $loopResult)
    {
        /** @var DealerContactInfo $contact */
        foreach ($loopResult->getResultDataCollection() as $contact) {
            $loopResultRow = new LoopResultRow($contact);

            $loopResultRow
                ->set('ID', $contact->getId())
                ->set('CONTACT_ID', $contact->getContactId())
                ->set('CONTACT_TYPE', $contact->getContactType())
                ->set('CONTACT_TYPE_ID', $contact->getContactTypeId());

            if ($contact->hasVirtualColumn('i18n_VALUE')) {
                $loopResultRow->set("VALUE", $contact->getVirtualColumn('i18n_VALUE'));
            }

            $loopResult->addRow($loopResultRow);
        }

        return $loopResult;
    }
92139
public function setFirstResult($firstResult)
    {
        $this->_firstResult = $firstResult;
        $this->_state       = self::STATE_DIRTY;

        return $this;
    }
831029
protected function getFetchTimer($waitForResult)
    {
        if (!$waitForResult) {
            return new TimeoutTimer($this->delay);
        }

        if ($this->timeout == -1) {
            return new UnlimitedTimer();
        }

        return new TimeoutTimer($this->timeout);
    }
1081357
private function appendListRowsFromEvents($paginationResult, string $postType)
    {
        $customListRows = Event::fire('post:table_list_rows', [$paginationResult, $postType]);

        foreach($customListRows as $customList){
            if(is_array($customList)) {
                foreach ($customList as $rowID => $rows) {
                    if (isset($paginationResult->items()[$rowID])) {
                        foreach ($rows as $key => $value) {
                            $paginationResult->items()[$rowID]->$key = $value;
                        }
                    }
                }
            }
        }

        return $paginationResult;
    }
845375
public function serialiseResult($executionResult)
    {
        // Format object
        if (!empty($executionResult->errors)) {
            return [
                'data' => $executionResult->data,
                'errors' => array_map($this->errorFormatter, $executionResult->errors),
            ];
        } else {
            return [
                'data' => $executionResult->data,
            ];
        }
    }
681229
protected function extendsParseResults(LoopResult $loopResult)
    {
        $eventName = $this->getDispatchEventName(TheliaEvents::LOOP_EXTENDS_PARSE_RESULTS);
        if (null !== $eventName) {
            $this->dispatcher->dispatch(
                $eventName,
                new LoopExtendsParseResultsEvent($this, $loopResult)
            );
        }

        return $loopResult;
    }
95998
public function dispatch($rawResult)
    {
        if (!is_array($rawResult)) {
            throw new \Exception('Response type must be an Array');
            exit;
        }

        $this->rawResult = $rawResult;
        $this->arrayResult = $rawResult;

        return $this->extractResult();
    }
604459
private function parseQueryResult($result = [])
    {
        $rdsDeliveryExecution = new RdsDeliveryExecution($this);

        if (array_key_exists(self::COLUMN_ID, $result)) {
            $rdsDeliveryExecution->setIdentifier($result[self::COLUMN_ID]);
        }

        if (array_key_exists(self::COLUMN_LABEL, $result)) {
            $rdsDeliveryExecution->setLabel($result[self::COLUMN_LABEL]);
        }

        if (array_key_exists(self::COLUMN_DELIVERY_ID, $result)) {
            $rdsDeliveryExecution->setDelivery($result[self::COLUMN_DELIVERY_ID]);
        }

        if (array_key_exists(self::COLUMN_STATUS, $result)) {
            $rdsDeliveryExecution->setState($result[self::COLUMN_STATUS]);
        }

        if (array_key_exists(self::COLUMN_USER_ID, $result)) {
            $rdsDeliveryExecution->setUserIdentifier($result[self::COLUMN_USER_ID]);
        }

        if (array_key_exists(self::COLUMN_STARTED_AT, $result)) {
            $rdsDeliveryExecution->setStartTime(new \DateTime($result[self::COLUMN_STARTED_AT]));
        }

        if (array_key_exists(self::COLUMN_FINISHED_AT, $result)) {
            $rdsDeliveryExecution->setFinishTime(new \DateTime($result[self::COLUMN_FINISHED_AT]));
        }

        return $this->propagate(new DeliveryExecution($rdsDeliveryExecution));
    }
1040334
public function filterByLanguagePresets($queryResult, array $presets) {
    $result = $queryResult;

    if (!empty($presets)) {
      $sysLanguageUid = $this->languageService->getSysLanguageUid();
      $preset         = intval($presets[$sysLanguageUid]);

      if (isset($preset)) {
        $result = [];

        foreach ($queryResult as $object) {
          $uid = $object->getSysLanguageUid();

          if (isset($uid) && $uid == $preset) {
            $result[] = $object;
          }
        }
      }
    }

    return $result;
  }
1335011
public function fromArray($itemResultSet)
    {
        if ($itemResultSet instanceof \Closure) {
            $itemResultSet = $itemResultSet($this->table);
        }

        $initialBuild = false;
        if (!$this->entitiesGraph) {
            $initialBuild = true;
        }

        if (is_numeric($itemResultSet)) {
            return $itemResultSet;
        }

        if (!$itemResultSet) {
            return null;
        }

        if ($itemResultSet instanceof Collection) {
            if (0 == $itemResultSet->count()) {
                if ($this->fromArrayResultCallback) {
                    $method = $this->fromArrayResultCallback;
                    return $method([]);
                } else {
                    return [];
                }
            }

            $resultSet = [];
            foreach ($itemResultSet as $offset => $itemSpec) {
                $resultSet[$offset] = $this->fromArray($itemSpec);
            }

            if (isset($this->fromArrayResultCallback)) {
                $method = $this->fromArrayResultCallback;
                return $method($resultSet);
            }

            return $resultSet;
        }

        $initialObject = $itemResultSet;
        if (is_object($itemResultSet)) {
            if (!method_exists($itemResultSet, 'toArray')) {
                throw new \InvalidArgumentException(
                    'The item result set, if an object, must contain the method toArray which converts the result set to a flat array'
                );
            }
            $itemResultSet = $itemResultSet->toArray();
        }

        if ($this->toClassName instanceof \Closure) {
            $subMapper = call_user_func($this->toClassName, $itemResultSet);
        } else {
            $subMapper = $this->toClassName;
        }

        $refl   = new \ReflectionClass($subMapper);
        $entity = $refl->newInstanceWithoutConstructor();

        // Map simple column to properties types
        foreach ($this->columnsToProperties as $columnName => $propertyName) {
            if (array_key_exists($propertyName, $this->propertiesToMappers)) {
                continue;
            }
            $prop = $refl->getProperty($propertyName);
            $prop->setAccessible(true);

            try {
                $value = $this->getValueFromArrayByKey($columnName, $itemResultSet);

                if (array_key_exists($propertyName, $this->propertiesFromArrayCallbacks)) {
                    $value = call_user_func_array(
                        $this->propertiesFromArrayCallbacks[$propertyName],
                        [$value]
                    );
                }

            } catch (\Exception $e) {
                $value = new NotPopulatedPropertyValue($propertyName, get_class($this));
            }

            $prop->setValue($entity, $value);
        }

        // Map simple properties types (that do not have any columns)
        foreach ($this->properties as $propertyName) {
            if (in_array($propertyName, $this->columnsToProperties)) {
                continue;
            }
            $prop = $refl->getProperty($propertyName);
            $prop->setAccessible(true);

            if (array_key_exists($propertyName, $this->propertiesFromArrayCallbacks)) {
                $value = call_user_func_array(
                    $this->propertiesFromArrayCallbacks[$propertyName],
                    [$itemResultSet]
                );
                $prop->setValue($entity, $value);
            }
        }

        // Map Class Types
        foreach ($this->propertiesToClasses as $propertyName => $subMapper) {
            $prop = $refl->getProperty($propertyName);
            $prop->setAccessible(true);

            $value = $subMapper->fromArray(
                $itemResultSet
            );

            $prop->setValue($entity, $value);
        }

        $this->entitiesGraph[get_class($this)] = $entity;

        // Map via Mappers
        foreach ($this->propertiesToMappers as $propertyName => $mapperClassName) {
            $columnName = array_search($propertyName, $this->columnsToProperties);

            /** @var DoplioDataMapper $subMapper */
            $subMapper = $this->resolver->resolve($mapperClassName);
            $subMapper->setEntitiesGraph($this->entitiesGraph);
            $prop = $refl->getProperty($propertyName);
            $prop->setAccessible(true);

            $value = null;

            if (array_key_exists($mapperClassName, $this->entitiesGraph)) {
                $value = $this->entitiesGraph[$mapperClassName];
            } else {
                if (array_key_exists($columnName, $itemResultSet)) {
                    $value                                 = $subMapper->fromArray(
                        $initialObject->$columnName
                    );
                    $this->entitiesGraph[$mapperClassName] = $value;

                    $this->identityMap += $subMapper->identityMap;
                } else {
                    $value = new NotPopulatedPropertyValue($propertyName, get_class($this));
                }
            }

            $prop->setValue($entity, $value);
        }

        if (!is_array($initialObject)) {
            $this->identityMap[] = [
                $initialObject,
                $entity
            ];
        }

        if ($initialBuild) {
            $this->entitiesGraph = [];
        }
        return $entity;
    }
856550
public static function create( LoopInterface $loop ) {

		// Check clients are installed
		if ( ! static::hasDependency() ) {
			exit(Codes::MOSQUITTO_CLIENTS_NOT_INSTALLED);
		}

		// Check config files presents
		if ( ! file_exists( $_SERVER['HOME'] . '/.config/mosquitto_pub' ) ) {
			exit(Codes::MOSQUITTO_PUB_CONFIG_MISSING);
		}

		if ( ! file_exists( $_SERVER['HOME'] . '/.config/mosquitto_sub' ) ) {
			exit(Codes::MOSQUITTO_SUB_CONFIG_MISSING);
		}

		return new static( $loop );
	}
515846
public function actionLoop($loopLimit = 1000, $spoolLimit = 10)
    {
        for ($i = 0; $i < $loopLimit; $i++) {
            $done = Yii::app()->emailManager->spool($spoolLimit);
            if ($done) {
                for ($i = 0; $i < $done; $i++) {
                    echo '.';
                }
            }
            sleep(1);
        }
    }
750487
public function execute($cacheResult = false)
    {
        $queryHash = md5(json_encode($this->queryBuilder->getRequest()));
        if ($cacheResult === true && isset(self::$runtimeQueryResultCache[$queryHash])) {
            return self::$runtimeQueryResultCache[$queryHash];
        }
        $queryResult = new ElasticSearchQueryResult($this);
        self::$runtimeQueryResultCache[$queryHash] = $queryResult;

        return $queryResult;
    }
1027793
public function newClient(LoopInterface $loop = null)
    {
        return new Client($this->getConfig('realm'), $this->getRegisteredProviders(), $loop);
    }
484244
public static function invoke(
        ValidationResultFields $validationResultFields,
        ValidationResultFields $validationResultFieldsMore
    ): ValidationResultFields {
        $code = '';

        if (!$validationResultFields->isValid()) {
            $code = $validationResultFields->getCode();
        }

        if (!$validationResultFieldsMore->isValid()) {
            $code = $validationResultFieldsMore->getCode();
        }

        $isValid = ($validationResultFields->isValid() && $validationResultFieldsMore->isValid());

        $details = array_merge(
            $validationResultFields->getDetails(),
            $validationResultFieldsMore->getDetails()
        );

        $mergedFieldResults = array_merge(
            $validationResultFields->getFieldResults(),
            $validationResultFieldsMore->getFieldResults()
        );

        return new ValidationResultFieldsBasic(
            $isValid,
            $code,
            $details,
            $mergedFieldResults
        );
    }
246669
private function compileBlockOptions(\Twig_Compiler $compiler, $loopId = null)
    {
        $options = $this->getAttribute('options');

        if (null !== $loopId) {
            $compiler
                ->raw('array_merge(')
                ->subcompile($options)
                ->raw(', array(\'id\' => ')->string($loopId.'__')->raw('.$key)')
                ->raw(')')
            ;
        } else {
            $compiler->subcompile($options);
        }
    }
87363
public function parseResults(LoopResult $loopResult)
    {
        /** @var \IndexEngine\Model\IndexEngineDriverConfiguration $entry */
        foreach ($loopResult->getResultDataCollection() as $entry) {
            $row = new LoopResultRow($entry);

            $row
                ->set("ID", $entry->getId())
                ->set("CODE", $entry->getCode())
                ->set("DRIVER_CODE", $entry->getDriverCode())
                ->set("TITLE", $entry->getTitle())
                ->set("SERIALIZED_CONFIGURATION", $entry->getSerializedConfiguration())
            ;

            $this->addMoreResults($row, $entry);

            $loopResult->addRow($row);
        }

        return $loopResult;
    }