src/Console/ConfigurationResolver.php
private function parseRules()
    {
        if (null === $this->options['rules']) {
            return $this->getConfig()->getRules();
        }

        $rules = trim($this->options['rules']);
        if ('' === $rules) {
            throw new InvalidConfigurationException('Empty rules value is not allowed.');
        }

        if ('{' === $rules[0]) {
            $rules = json_decode($rules, true);
            if (JSON_ERROR_NONE !== json_last_error()) {
                throw new InvalidConfigurationException(sprintf('Invalid JSON rules input: %s.', json_last_error_msg()));
            }

            return $rules;
        }

        $rules = [];

        foreach (explode(',', $this->options['rules']) as $rule) {
            $rule = trim($rule);
            if ('' === $rule) {
                throw new InvalidConfigurationException('Empty rule name is not allowed.');
            }

            if ('-' === $rule[0]) {
                $rules[substr($rule, 1)] = false;
            } else {
                $rules[$rule] = true;
            }
        }

        return $rules;
    }
private function parseRules()
    {
        if (null === $this->options['rules']) {
            return $this->getConfig()->getRules();
        }

        $rules = trim($this->options['rules']);
        if ('' === $rules) {
            throw new InvalidConfigurationException('Empty rules value is not allowed.');
        }

        if ('{' === $rules[0]) {
            $rules = json_decode($rules, true);
            if (JSON_ERROR_NONE !== json_last_error()) {
                throw new InvalidConfigurationException(sprintf('Invalid JSON rules input: %s.', json_last_error_msg()));
            }

            return $rules;
        }

        $rules = [];

        foreach (explode(',', $this->options['rules']) as $rule) {
            $rule = trim($rule);
            if ('' === $rule) {
                throw new InvalidConfigurationException('Empty rule name is not allowed.');
            }

            if ('-' === $rule[0]) {
                $rules[substr($rule, 1)] = false;
            } else {
                $rules[$rule] = true;
            }
        }

        return $rules;
    }
private function parseRules ( ) { if ( null === $ this -> options [ 'rules' ] ) { return $ this -> getConfig ( ) -> getRules ( ) ; } $ rules = trim ( $ this -> options [ 'rules' ] ) ; if ( '' === $ rules ) { throw new InvalidConfigurationException ( 'Empty rules value is not allowed.' ) ; } if ( '{' === $ rules [ 0 ] ) { $ rules = json_decode ( $ rules , true ) ; if ( JSON_ERROR_NONE !== json_last_error ( ) ) { throw new InvalidConfigurationException ( sprintf ( 'Invalid JSON rules input: %s.' , json_last_error_msg ( ) ) ) ; } return $ rules ; } $ rules = [ ] ; foreach ( explode ( ',' , $ this -> options [ 'rules' ] ) as $ rule ) { $ rule = trim ( $ rule ) ; if ( '' === $ rule ) { throw new InvalidConfigurationException ( 'Empty rule name is not allowed.' ) ; } if ( '-' === $ rule [ 0 ] ) { $ rules [ substr ( $ rule , 1 ) ] = false ; } else { $ rules [ $ rule ] = true ; } } return $ rules ; }
Compute rules.

@return array
Compute rules .