@param array $result

@return Person[]
356286
private function buildPeople($result)
    {
        $people = [];

        foreach ($result as $person) {
            $people[] = $this->personBuilder
                ->create()
                ->withAddress($person['address'])
                ->withBirthdate($person['birthdate'] !== null ? new \DateTime($person['birthdate']) : null)
                ->withCustomFields($person['custom_fields'])
                ->withEmail($person['email'])
                ->withFirstName($person['first_name'])
                ->withGuardianEmail($person['guardian_email'])
                ->withGuardianName($person['guardian_name'])
                ->withId($person['id'])
                ->withJoinedAt($person['joined_at'] !== null ? new \DateTime($person['joined_at']) : null)
                ->withLastName($person['last_name'])
                ->withLocationId($person['location_id'])
                ->withMiddleName($person['middle_name'])
                ->withPhone($person['phone'])
                ->withPrimaryStaffMember(
                    isset($person['primary_staff_member']) ? $person['primary_staff_member'] : null
                )
                ->withStaffContactId(
                    isset($person['staff_contact_id']) ? $person['staff_contact_id'] : null
                )
                ->build();
        }

        return $people;
    }
179781
private function getErrorMessage(array $result)
    {
        $errorMessage = '';
        if (isset($result['errors'][0]['property']) && isset($result['errors'][0]['message'])) {
            $errorMessage = $result['errors'][0]['property'] . ': ' . $result['errors'][0]['message'];
        }
        return $errorMessage;
    }
267612
private function makeTree(array $result)
    {
        $tree = [];

        foreach ($result as $row) {
            $this->makeNode($row, $tree);
        }

        return $tree;
    }
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));
    }
924128
protected static function parseSetOf(&$data, &$result)
    {
        $data = self::parseCommon($data, $sequenceData);
        $result[] = [
            'set (' . self::$len . ')',
            self::parseASN((string) $sequenceData), ];
    }
567530
protected function createModelFromDatabaseResult(array $result)
    {
        $model = $this->getEmptyModel();

        foreach ($result as $key => $value) {
            if ($key === $this->idProperty) {
                $model->setIdRaw($value);
            }

            $model->setPropertyRaw($key, StringUtil::deserialize($value));
        }

        return $model;
    }
1066031
final public function getResult($result = '')
    {
        $result.= $this->generate();
        if ($this->successor !== null) {
            return $this->successor->getResult($result);
        }

        return $result;
    }
241233
private static function toRow(ResultInterface $result): array
    {
        $row = [
            'id' => $result->getChecker()->getId(),
            'link' => $result->getChecker()->getLink(),
            'description' => $result->getChecker()->getDescription(),
            'status' => $result->getStatus(),
            'messages' => $result->getMessages(),
        ];

        $row['status'] = self::colorize($result, $row['status']);
        $row['message'] = implode(PHP_EOL, $row['messages']);

        return $row;
    }
317699
public function getUsers(Result $result, $canEdit)
    {
        if (!$canEdit) {
            return [];
        }

        $repo = $this->om->getRepository('ClarolineCoreBundle:User');
        $roles = $result->getResourceNode()->getWorkspace()->getRoles()->toArray();
        $users = $repo->findUsersByRolesIncludingGroups($roles);

        return array_map(function ($user) {
            return [
                'id' => $user->getId(),
                'name' => "{$user->getFirstName()} {$user->getLastName()}",
            ];
        }, $users);
    }
144576
public function findByResultAndUser(Result $result, User $user)
    {
        $dql = '
            SELECT
                u.id,
                CONCAT(u.firstName, \' \', u.lastName) AS name,
                m.value AS mark,
                m.id AS markId
            FROM Claroline\ResultBundle\Entity\Mark m
            JOIN m.user u
            WHERE m.result = :result
            AND u = :user
            ORDER BY u.lastName ASC
        ';

        $query = $this->_em->createQuery($dql);
        $query->setParameters([
            'result' => $result,
            'user' => $user,
        ]);

        return $query->getArrayResult();
    }
630627
public static function checkAttributes(array $result)
    {
        $expectedAttributes = [
            self::ON_PEP_LIST_KEY,
            self::ON_WATCH_LIST_KEY,
            self::ON_WATCH_LIST_KEY,
        ];
        $providedAttributes = array_keys($result);
        $missingAttr = array_diff($expectedAttributes, $providedAttributes);

        // Throw an error if any expected attribute is missing.
        if (!empty($missingAttr)) {
            throw new AmlException('Missing attributes from the result: ' . implode(',', $missingAttr), 106);
        }
    }
495422
public function mapFromResults(array $arr_results)
    {
        $arr_entities = [];
        foreach ($arr_results as $obj_result) {
            $arr_entities[] = $this->mapOneFromResult($obj_result);
        }
        return $arr_entities;
    }
960862
protected function reduceResult($result)
    {
        if (is_array($result) && (count($result) == 1)) {
            reset($result);
            return $this->reduceResult($result[key($result)]);
        } else {
            return $result;
        }
    }
237139
private function mapArrayStringToArrayInt($results)
    {
        $ret = [];

        foreach ($results as $value) {
            array_push($ret, intval($value));
        }

        return $ret;
    }
599984
protected static function parseSequence(&$data, &$result)
    {
        // Sequence
        $data = self::parseCommon($data, $sequenceData);
        $values = self::parseASN((string) $sequenceData);
        if (! is_array($values) || is_string($values[0])) {
            $values = [$values];
        }
        $result[] = [
            'sequence (' . self::$len . ')',
            $values, ];
    }
872328
public function read(&$result)
    {
        $relations = [];
        $conditions = [];

        foreach ($result as $i => $entity) {
            $container = $this->accessor->getPropertyValue($entity, $this->definition->container());
            if (empty($container)) {
                $this->accessor->setPropertyValue($entity, $this->definition->container(), []);
            }

            foreach ($this->definition->keys() as $local => $refer) {
                $conditions[$refer][] = $this->accessor->getPropertyValue($entity, $local);
            }

            $relations[$this->buildLocalKey($entity, $this->definition->keys())][] = &$result[$i];
        }

        $collection = $this->fetch($this->definition->entity(), $conditions, true);

        foreach ($collection as $relEntity) {
            $key = $this->buildForeignKey($relEntity, $this->definition->keys());

            if (!isset($relations[$key])) {
                continue;
            }

            foreach ($relations[$key] as &$entity) {
                $this->accessor->addPropertyValue($entity, $this->definition->container(), $relEntity);
                unset($entity);
            }
        }

        return $result;
    }
310195
private function getDependencies(array $results)
    {
        $dependencies = [];
        $doubles = [];

        foreach ($results as $name => $result) {
            $type = $this->recursive ? Dependency::PROHIBITS : Dependency::DEPENDS;
            $dependency = Dependency::create($name, $type, $result);
            $unique = (string) $dependency->getLink();
            if (isset($doubles[$unique])) {
                continue;
            }
            $doubles[$unique] = true;
            $dependencies[] = $dependency;
        }

        return $dependencies;
    }