@param AdviceInterface[] $advice

@return array
341012
private static function encodeAdvice(array $advice): array
    {
        $result = [];
        foreach ($advice as $item) {
            /** @var AdviceInterface $item*/
            $result[$item->getAppliesTo()][] = $item->getCallable();
        }

        return $result;
    }
1141040
def to_row(advice):
    ''''''
    return [
        advice.id,
        advice.administration,
        advice.type,
        advice.session.year,
        advice.session.strftime('%d/%m/%Y'),
        advice.subject,
        ', '.join(advice.topics),
        ', '.join(advice.tags),
        ', '.join(advice.meanings),
        ROMAN_NUMS.get(advice.part, ''),
        advice.content,
    ]
476291
public function getValidatorMessages()
    {
        $messages = [];
        
        foreach ($this->owner->getValidatorRules() as $rule) {
            
            if ($rule->hasMessage()) {
                $messages[$rule->getType()] = $rule->getMessage();
            }
            
        }
        
        return $messages;
    }
132566
protected function parseRulesArray(array $rules)
    {
        $parsedRules = [];

        $rawRules = (new ValidationRuleParser($this->data))->explode($rules);

        foreach ($rawRules->rules as $attribute => $attributeRules) {
            foreach ($attributeRules as $attributeRule) {
                $parsedRule = $this->parseRuleString($attributeRule);
                if ($parsedRule) {
                    $parsedRules[$attribute][] = $parsedRule;
                }
            }
        }

        return $parsedRules;
    }
1052268
public function getDetailMessages()
    {
        $messages = array();
        foreach ($this->invalidRules as $field => $rules) {
            foreach ($rules as $rule) {
                $messages[$field][$rule] = $this->ruleValidators[$field][$rule]->getMessages();
            }
        }
        return $messages;
    }
303728
protected function ruleToArray($rule)
    {
        if ($rule instanceof ConstraintGroup || $rule instanceof Constraint) {
            return $this->constraintToArray($rule);
        }

        return $this->parseConstraint($rule);
    }
1041005
protected function getRulesNames(AllOf $rules): array
    {
        $rulesNames = [];
        foreach ($rules->getRules() as $rule) {
            try {
                $rulesNames[] = lcfirst((new ReflectionClass($rule))->getShortName());
            } catch (ReflectionException $e) {
            }
        }

        return $rulesNames;
    }
139595
public function toLdap(array $entry)
    {
        $toLdap = [];

        foreach ($entry as $attribute => $value) {
            $toLdap[$this->schema->getAttributeToLdap($attribute)] = $value;
        }

        return $toLdap;
    }
574921
public static function getAppliedAdvice(int $evaluation, array $advice): array
    {
        $result = array_key_exists($evaluation, $advice) === true ? $advice[$evaluation] : [];

        return $result;
    }
785771
private function loadAdvisorsList(AspectContainer $aspectContainer): array
    {
        /** @var AspectLoader $aspectLoader */
        $aspectLoader   = $aspectContainer->get('aspect.cached.loader');
        $aspects        = $aspectLoader->getUnloadedAspects();
        foreach ($aspects as $aspect) {
            $aspectLoader->loadAndRegister($aspect);
        }
        $advisors = $aspectContainer->getByTag('advisor');

        return $advisors;
    }
265622
protected function _getRules() {
        $relation = $this->getRelation();
        $localModel = $relation->getLocalModel();

        $hasNameConflict = $relation->name === $localModel->id;
        if ($hasNameConflict) {
            return array($relation->name . '1', $relation->name . '2');
        }

        $modelIds = $this->_getModelIdsAlphabetically();

        $rules = array($relation->name, $this->_getSecondRule());
        $rules = $this->_sortRulesEgocentrically($rules);

        return $rules;
    }
890182
public function getScenarios(): array
    {
        if ($this->scenario === null) {
            return $this->rules;
        }

        $rules = [];

        foreach ($this->rules as $rule) {
            if (! isset($rule['on']) && ! isset($rule['except'])) {
                $rules[] = $rule;
            } elseif (isset($rule['on']) && $this->matchScenario($rule['on'])) {
                unset($rule['on']);
                $rules[] = $rule;
            } elseif (isset($rule['except']) && $this->matchScenario($rule['except'])) {
                unset($rule['except']);
                $rules[] = $rule;
            }
        }

        return $rules;
    }
174297
public static function serializeAdvice(Closure $adviceMethod): array
    {
        $refAdvice = new ReflectionFunction($adviceMethod);

        return [
            'method' => $refAdvice->name,
            'class'  => $refAdvice->getClosureScopeClass()->name
        ];
    }
543718
public function getTooltipAttributes():array
    {
        if ($this->tooltip !== null) {
            $attrs = $this->tooltipOptions;
            $attrs['data-toggle'] = 'tooltip';
            $attrs['title'] = $this->tooltip;
            return $attrs;
        }
        return [];
    }
850882
public function help($help, $attributes = [])
    {
        $this->help = $help;

        return parent::help($help, $attributes);
    }
1092960
public function addRule(RuleInterface $rule): array
    {
        $this->getSerializer()->clearBlocksWithStart()->clearBlocksWithEnd();

        $result = [
            static::RULES_SINGLE_INDEX         => $this->getSerializer()->addBlock($rule->toBlock()),
            static::RULES_SINGLE_START_INDEXES => $this->getSerializer()->getBlocksWithStart(),
            static::RULES_SINGLE_END_INDEXES   => $this->getSerializer()->getBlocksWithEnd(),
        ];

        return $result;
    }
106083
protected function extractKeywordIdsFromConditionAttribute(array $attribute)
    {
        if (!isset($attribute['keywords'])) {
            return array();
        }

        $condition = $attribute['keywords'];
        $patterns = explode('|', KeywordableTraitInterface::OPERATOR_SPLIT);
        $conditionWithoutOperator = preg_replace($patterns, ' ', $condition);
        $keywordArray = explode(' ', $conditionWithoutOperator);

        return $keywordArray;
    }