Convert the ems rules into the laravel format

@param array $parsedRules

@return array
349403
protected function toLaravelRules(array $parsedRules)
    {
        $laravelRules = [];

        foreach ($parsedRules as $key=>$keyRules) {
            $laravelRules[$key] = [];

            foreach ($keyRules as $ruleName=>$parameters) {
                $separator = $parameters ? ':' : '';
                $laravelRules[$key][] = $ruleName.$separator.implode(',', $parameters);
            }
        }

        return $laravelRules;
    }
72235
public function getRules()
    {
        $this->defaultParams['num_decimals']    = 2;
        $this->defaultParams['num_decimals']    = 2;
        $this->defaultParams['round_type']      = Formatter::ROUND_CLASSIC;
        $this->defaultParams['decimal_sep']     = '.';
        $this->defaultParams['thousands_sep']   = ' ';
        $this->defaultParams['format_positive'] = '%v %s';
        $this->defaultParams['format_negative'] = '-%v %s';

        return array(
            'eur' => array(
                'symbol' => '€',
                'rate'   => 1,
            ),

            'usd' => array(
                'symbol'          => '$',
                'format_positive' => '%s%v',
                'format_negative' => '-%s%v',
                'rate'            => 0.5,
            ),

            'rub' => array(
                'symbol'      => 'руб.',
                'decimal_sep' => ',',
                'rate'        => 0.02,
            ),

            'uah' => array(
                'symbol'      => 'грн.',
                'decimal_sep' => ',',
                'rate'        => 0.04,
            ),

            'byr' => array(
                'symbol'       => 'Br',
                'round_type'   => Formatter::ROUND_CEIL,
                'round_value'  => '-2',
                'num_decimals' => '0',
                'rate'         => 0.00005,
            ),

            '%'   => array(
                'symbol'          => '%',
                'format_positive' => '%v%s',
                'format_negative' => '-%v%s',
            ),
        );
    }
319870
protected function arrayToCss(array $rules)
    {
        $strings = [];

        foreach ($rules as $key => $value) {
            $strings[] = $key . ': ' . $value;
        }

        return implode('; ', $strings);
    }
628285
public static function getRulePos($rules) {
		$result = 1;
		$before = array();
		$after  = array();

		foreach($rules as $key => $val) {
			if($key == '<module:\w+>/<controller:\w+>/<action:\w+>')
				break;
			$result++;
		}

		$i = 1;
		foreach($rules as $key => $val) {
			if($i < $result)
				$before[$key] = $val;
			elseif($i >= $pos)
				$after[$key]  = $val;
			$i++;
		}

		return array('after' => $after, 'before' => $before);
	}
238893
protected function getFormRules(array $fields)
    {
        $rules = [];

        foreach ($fields as $field) {
            /** @var FieldTypeInterface $field */
            $rules[$field->getName()] = $field->getOption('rules');
        }

        return $rules;
    }
1342937
private function parseRule($rule) {
		$parsed = [false];
		if (preg_match('#^([a-z][a-z\d_]+)\s*\((.+)\)\s*$#i', $rule, $ms)) {
			$method = trim($ms[1]);
			$ops    = trim($ms[2]);
		} else {
			$method = trim($rule);
			$ops    = '';
		}
		$parsed[0] = $method;
		$parsed[1] = $ops;

		return $parsed;
	}
279178
protected function getCustomizedRuleKeysToKeepDefault(array $customRules)
    {
        $keys = [];

        foreach ($customRules as $key => $ruleParts) {

            // If the configured value is the name of a key (and so it is a non-associative
            // part of the rules), it indicates that the default should be kept/copied over,
            // for the key the value denotes.
            if (is_string($ruleParts) && is_numeric($key)) {
                $keys[] = $ruleParts;
            }
        }

        return $keys;
    }
277873
public static function parseDotRule($rule)
    {
        $result = preg_split('#(?<!\\\)\.#', $rule);
        array_walk($result, function(&$value, $key){
            if(false !== strpos($value,'\.'))
            {
                $value = str_replace('\.', '.', $value);
            }
        });
        return $result;
    }
402049
protected function parseRules(array $rules)
    {
        $parsedRules = [];

        foreach ($rules as $attribute => $filters) {
            if (empty($filters)) {
                throw new InvalidFilterException(
                    "The attribute [$attribute] must contain at least one filter."
                );
            }

            $this->parseAttributeFilters($parsedRules, $attribute, $filters);
        }

        return $parsedRules;
    }
1259040
public function validateDataWithRules(array $data, array $validateRules, array $validateMessages = [], array $parametricConverter = [])
    {
        foreach ($validateRules as $key => $rules) {
            $value = array_key_exists($key, $data) ? $data[$key] : null;

            if (array_key_exists('nullable', $rules) && $rules['nullable'] && is_null($value)) {
                continue;
            }

            unset($rules['nullable']);

            $defaultParametricConverter = (method_exists($this, 'getParametricConverter') && is_array($this->getParametricConverter())) ? $this->getParametricConverter() : [];
            $parametricConverter = array_merge($defaultParametricConverter, $parametricConverter);
            $parameter = (array_key_exists($key, $parametricConverter)) ? $parametricConverter[$key] : $key;

            foreach ($rules as $ruleName => $ruleParameter) {
                if ($ruleName === 'callback') {
                    if (!is_callable($ruleParameter)) {
                        throw new BadMethodCallException('The reference of rule named `callback` must be a valid callable. You provided ' . $this->getValueDescription($ruleParameter) . '.');
                    }

                    call_user_func($ruleParameter, $value, InvalidRequestException::class);
                } else {
                    $method = 'check'.ucfirst(Helper::camelCase($ruleName));

                    if (!method_exists($this, $method)) {
                        throw new BadMethodCallException('Call to undefined the ' .get_class($this). '::' .$method. '() validator that associated with the `' .$ruleName. '` rule');
                    }

                    if (!$this->$method($value, $ruleParameter)) {
                        $message = isset($validateMessages[$key][$ruleName]) ? $validateMessages[$key][$ruleName] : null;

                        throw new InvalidRequestException($this->formatMessage($parameter, $ruleName, $ruleParameter, $message));
                    }
                }
            }
        }
    }
393298
protected function getValidationRulesForAttributes(array $modelParams, array $rules = []): array
    {
        $modelRules = empty($rules) ? $this->getValidationRules() : $rules;
        return array_intersect_key($modelRules, $modelParams);
    }
1222545
public function validationRules():array
    {
        $rules = [];

        foreach ($this as $control) {
            $rule = $control->getRule();
            if (!empty($rule)) {
                $rules[$control->getName()] = $control->getRule();
            }
        }

        return $rules;
    }
281587
protected function parseRule($rules)
    {
        if (is_array($rules)) {
            return $this->parseArrayRule($rules);
        }
        if(is_string($rules)) {
            return $this->parseStringRule($rules);
        }
    }
822736
public function getRules($overrideRules = [])
    {
        $fieldRules = $this->formHelper->mergeFieldsRules($this->fields);

        return array_merge($fieldRules->getRules(), $overrideRules);
    }
1076981
protected function explodeRules( $rules )
	{
		foreach ( $rules as $key => $rule )
		{
			if ( Str::contains( $key, '*' ) )
			{
				$this->each( $key, [$rule] );

				unset( $rules[$key] );
			}
			else
			{
				$rules[$key] = ( is_string( $rule ) ) ? explode( '|', $rule ) : $rule;
			}
		}

		return $rules;
	}
1151631
public function getRules($css, $existingRules = [])
    {
        $css = $this->doCleanup($css);
        $rulesProcessor = new RuleProcessor();
        $rulesByMediaQuery = $rulesProcessor->splitIntoSeparateMediaQueries($css);

        return $rulesProcessor->convertArrayToObjects($rulesByMediaQuery, $existingRules);
    }
928512
protected function explode($rules)
    {
        foreach ($rules as $key => $rule) {
            $rules[$key] = explode('|', $rule);
        }

        return $rules;
    }