@param string|null $restriction

@return array
171673
public function getSortedEventsForFilter($restriction = null)
    {
        $textEvents = $this->getEvents($restriction);
        $allTranslatedText = $this->translator->trans('all', [], 'log');
        $sortedEvents = [];
        $genericResourceEvents = [];
        $genericResourceEvents['all'] = 'all';
        $sortedEvents[$allTranslatedText] = 'all';
        $tempResourceEvents = [];

        foreach ($textEvents as $textEvent) {
            $explodeTextEvents = explode('-', $textEvent);
            $shortTextEvent = $explodeTextEvents[0].'-'.$explodeTextEvents[1];
            $eventTrans = $this->translator->trans($explodeTextEvents[0], [], 'log');

            if ('resource' === $explodeTextEvents[0]) {
                $tempResourceEvents['all'][$allTranslatedText] = $explodeTextEvents[0];
            } else {
                $sortedEvents[$eventTrans][$explodeTextEvents[0].': '.$allTranslatedText] = $explodeTextEvents[0];
            }

            if ('resource' === $explodeTextEvents[0]) {
                if (isset($explodeTextEvents[2])) {
                    $tempResourceEvents[$explodeTextEvents[1]][$this->translator->trans(
                        'log_'.$textEvent.'_filter', [], 'log'
                    )] = $textEvent;
                } else {
                    $genericResourceEvents[$explodeTextEvents[1]] = $shortTextEvent;
                }
            } elseif (isset($explodeTextEvents[2])) {
                $sortedEvents[$eventTrans][$this->translator->trans(
                    'log_'.$textEvent.'_filter', [], 'log'
                )] = $textEvent;
            } else {
                $sortedEvents[$eventTrans][$this->translator->trans(
                    'log_'.$shortTextEvent.'_filter', [], 'log'
                )] = $shortTextEvent;
            }
        }

        $resourceTrans = $this->translator->trans('resource', [], 'platform');

        // adding resource types that don't define specific event classes
        $remainingTypes = $this->om
            ->getRepository('ClarolineCoreBundle:Resource\ResourceType')
            ->findTypeNamesNotIn(array_keys($tempResourceEvents));

        foreach ($remainingTypes as $type) {
            $tempResourceEvents[$type['name']] = [];
        }

        foreach (array_keys($tempResourceEvents) as $sortedKey) {
            $keyTrans = $this->translator->trans($sortedKey, [], 'resource');

            foreach ($genericResourceEvents as $genericEvent) {
                $logTrans = $this->translator->trans(
                    'all' === $genericEvent ? $genericEvent : 'log_'.$genericEvent.'_filter',
                        [],
                        'log'
                    );

                $genericEvent = ('all' === $genericEvent) ? 'resource' : $genericEvent;

                if ('all' !== $sortedKey) {
                    $sortedEvents[$resourceTrans][$keyTrans][$keyTrans.': '.$logTrans] = '[['.$sortedKey.']]'.$genericEvent;
                } else {
                    $sortedEvents[$resourceTrans][$allTranslatedText]['resource: '.$logTrans] = $genericEvent;
                }
            }

            if ('all' !== $sortedKey) {
                foreach ($tempResourceEvents[$sortedKey] as $resourceEventKey => $resourceEventValue) {
                    $sortedEvents[$resourceTrans][$keyTrans][$resourceEventKey] = $resourceEventValue;
                }
            }
        }

        return $sortedEvents;
    }
1361876
public function getRange()
    {
        /** @var Range $constraint */
        if ($constraint = $this->docBlockUtility->getConstraint($this->property, Range::class)) {
            return [
                'min' => $constraint->min,
                'max' => $constraint->max,
            ];
        }
    }
115739
public function getQueryMap(array $protected = ['Error']): array
    {
        $queryMap = [];

        $controllers = ClassFinder::getClassesInNamespace(
            rtrim($this->configuration->getControllerNamespace(), '\\')
        );

        foreach ($controllers as $controller) {
            $controllerReflection = new \ReflectionClass($controller);
            $controllerAlias = str_replace('Controller', '', $controllerReflection->getShortName());

            if (in_array($controllerAlias, $protected)) {
                continue;
            }

            $actions = $controllerReflection->getMethods(\ReflectionMethod::IS_PUBLIC);

            foreach ($actions as $action) {
                if (1 === preg_match('(Partial|Passive|__construct)', $action->getName())) {
                    continue;
                }

                $actionAlias = str_replace('Action', '', $action->getName());
                $alias = $controllerAlias . ':' . $actionAlias;
                $queryMap[$alias] = $this->getQuery($alias);
            }
        }

        return $queryMap;
    }
1118274
public function getEventsForApiFilter($restriction = null)
    {
        $resourceOption = 'resource';
        $allOption = 'all';
        $eventNames = $this->getEvents($restriction);
        sort($eventNames);
        $sortedEvents = ['all' => 'all'];
        $genericResourceEvents = ['all' => 'all'];
        $tempResourceEvents = ['all' => []];

        foreach ($eventNames as $eventName) {
            $eventNameChunks = explode('-', $eventName);
            $eventKey = "log_${eventName}_filter";

            if ($eventNameChunks[0] !== 'clacoformbundle' && !isset($sortedEvents[$eventNameChunks[0]])) {
                $sortedEvents[$eventNameChunks[0]] = ['all' => "${eventNameChunks[0]}::all"];
            }

            if ($resourceOption === $eventNameChunks[0]) {
                if (isset($eventNameChunks[2])) {
                    $tempResourceEvents[$eventNameChunks[1]][$eventKey] = $eventName;
                } else {
                    $genericResourceEvents[$eventKey] = $eventName;
                }
            } elseif ($eventNameChunks[0] === 'clacoformbundle') {
                $tempResourceEvents[$eventNameChunks[0]][$eventKey] = $eventName;
            } else {
                $sortedEvents[$eventNameChunks[0]][$eventKey] = $eventName;
            }
        }

        // adding resource types that don't define specific event classes
        $sortedEvents[$resourceOption][$allOption] = [];
        $remainingTypes = $this->om
            ->getRepository('ClarolineCoreBundle:Resource\ResourceType')
            ->findTypeNamesNotIn(array_keys($tempResourceEvents));

        foreach ($remainingTypes as $type) {
            $tempResourceEvents[$type['name']] = [];
        }

        foreach (array_keys($tempResourceEvents) as $resourceType) {
            if ($resourceType === 'resource_shortcut') {
                continue;
            }

            foreach ($genericResourceEvents as $genericEventKey => $genericEventName) {
                $eventPrefix = '';
                if ($allOption !== $resourceType) {
                    $eventPrefix = "${resourceOption}::${resourceType}::";
                }
                if ($allOption === $resourceType && $genericEventName === $allOption) {
                    $eventPrefix = "${resourceOption}::";
                }
                $sortedEvents[$resourceOption][$resourceType][$genericEventKey] = $eventPrefix.$genericEventName;
            }

            if ($allOption !== $resourceType) {
                foreach ($tempResourceEvents[$resourceType] as $resourceEventKey => $resourceEventName) {
                    $sortedEvents[$resourceOption][$resourceType][$resourceEventKey] = $resourceEventName;
                }
            }
        }

        return $this->formatEventsTableForApi($sortedEvents);
    }
886822
public function get(string $date = null) : array
    {
        if ($date === null) {
            $date = \date('Y-m-d');
        }

        return [
            'queued' => $this->queue->count(),
            'pass' => $this->queue->getStatsByType($date, 'pass'),
            'fail' => $this->queue->getStatsByType($date, 'fail'),
            'retry' => $this->queue->getStatsByType($date, 'retry'),
            'cancel' => $this->queue->getStatsByType($date, 'cancel')
        ];
    }
191040
public function _processClassDocBlock($block)
    {
        $result = [];
        if ($block instanceof \Zend\Code\Reflection\DocBlockReflection) {
            $docBlockLines = $block->getContents();
            $docBlockLines = explode("\n", $docBlockLines);
            foreach ($docBlockLines as $line) {
                $methodData = $this->_processClassDocLine($line);
                if ($methodData) {
                    $name = $methodData->getName();
                    $result[$name] = $methodData;
                }
            }
        }
        return $result;
    }
768047
public function validateRule(Rule $rule, array $restrictions = array())
    {
        /** @var \Claroline\CoreBundle\Rule\Constraints\AbstractConstraint[] $usedConstraints */
        $usedConstraints = array();
        $existedConstraints = $this->getConstraints();

        foreach ($existedConstraints as $existedConstraint) {
            if ($existedConstraint->isApplicableTo($rule)) {
                $usedConstraints[] = $existedConstraint->setRule($rule);
            }
        }

        $validatedConstraints = 0;
        $nbConstraints = count($usedConstraints);

        $associatedLogs = $this->getAssociatedLogs($usedConstraints, $restrictions);

        foreach ($usedConstraints as $usedConstraint) {
            $usedConstraint->setAssociatedLogs($associatedLogs);

            if ($usedConstraint->validate()) {
                ++$validatedConstraints;
            }
        }

        return ($validatedConstraints === $nbConstraints) ? $associatedLogs : false;
    }
1368711
public function getRuleList($domain = null)
    {
        $list = [];

        foreach ($this->rule as $ruleDomain => $rules) {
            foreach ($rules as $rule => $items) {
                foreach ($items as $item) {
                    $val['domain'] = $ruleDomain;

                    foreach (['method', 'rule', 'name', 'route', 'pattern', 'option'] as $param) {
                        $call = 'get' . $param;
                        $val[$param] = $item->$call();
                    }

                    $list[$ruleDomain][] = $val;
                }
            }
        }

        if ($domain) {
            return isset($list[$domain]) ? $list[$domain] : [];
        }

        return $list;
    }
290174
protected function getAssociatedLogs(array $constraints, array $restrictions = null)
    {
        $queryBuilder = $this->buildQuery($constraints, $restrictions);

        return $queryBuilder->getQuery()->getResult();
    }
902319
public function tag(string $tag): array
    {
        return $this->hasTag($tag) ? $this->tags[$tag] : null;
    }
895525
public function getRole(string $id = null): array
    {
        if ($id) {
            if (is_numeric($id)) {
                $filter = array_filter($this->role, function ($row) use ($id) { return $row['id'] == $id; });
                return (array) array_pop($filter);
            }
            return (array) ($this->role[$id] ?? []);
        }
        return $this->role;
    }
740624
protected function getValueBlockParameters(Limitation $limitation, array $parameters)
    {
        $values = $this->valueMapperRegistry
            ->getMapper($limitation->getIdentifier())
            ->mapLimitationValue($limitation);

        $parameters += [
            'limitation' => $limitation,
            'values' => $values,
        ];

        return $parameters;
    }
588718
public function getPossibleReturnTypes() : array
    {
        $types = [];
        if ($this->hasReturnType()) {
            $types[] = $this->getReturnType();
            if ($types[0]->allowsNull()) {
                $types[] = null;
            }
        }
        return $types;
    }
153
public static function getLocales($domain = null)
    {
        // Optionally filter by domain
        $domainObj = Domain::getByDomain($domain);
        if ($domainObj) {
            return $domainObj->getLocales();
        }

        return Locale::getCached();
    }
1006507
public function getDefinedOptions()
    {
        if (! $this->defined) {
            return null;
        }

        if ($this->defined instanceof ConfigInterface) {
            return $this->defined->getArrayCopy();
        }

        return (array)$this->defined;
    }
1360587
private function getLimitationTypes()
    {
        $limitationTypes = [];
        foreach ($this->policyMap as $module) {
            foreach ($module as $policy) {
                if (null === $policy) {
                    continue;
                }

                foreach (array_keys($policy) as $limitationType) {
                    if (!in_array($limitationType, $limitationTypes)) {
                        $limitationTypes[] = $limitationType;
                    }
                }
            }
        }

        return $limitationTypes;
    }
1191587
public function getParameters(array $allowed = null)
	{
		if ($allowed !== null)
		{
			return array_intersect_key($this->parameters, array_flip($allowed));
		}

		return $this->parameters;
	}