concrete/src/Console/Command/ServiceCommand.php
protected function parseRuleOptions(InputInterface $input)
    {
        $ruleOptions = [];
        foreach ($input->getArgument('rule-options') as $keyValuePair) {
            list($key, $value) = explode('=', $keyValuePair, 2);
            $key = trim($key);
            if (substr($key, -2) === '[]') {
                $isArray = true;
                $key = rtrim(substr($key, 0, -2));
            } else {
                $isArray = false;
            }
            if ($key === '' || !isset($value)) {
                throw new Exception(sprintf("Unable to parse the rule option '%s': it must be in the form of key=value", $keyValuePair));
            }
            if (isset($ruleOptions[$key])) {
                if (!($isArray && is_array($ruleOptions[$key]))) {
                    throw new Exception(sprintf("Duplicated rule option '%s'", $key));
                }
                $ruleOptions[$key][] = $value;
            } else {
                $ruleOptions[$key] = $isArray ? ((array) $value) : $value;
            }
        }

        return $ruleOptions;
    }
protected function parseRuleOptions(InputInterface $input)
    {
        $ruleOptions = [];
        foreach ($input->getArgument('rule-options') as $keyValuePair) {
            list($key, $value) = explode('=', $keyValuePair, 2);
            $key = trim($key);
            if (substr($key, -2) === '[]') {
                $isArray = true;
                $key = rtrim(substr($key, 0, -2));
            } else {
                $isArray = false;
            }
            if ($key === '' || !isset($value)) {
                throw new Exception(sprintf("Unable to parse the rule option '%s': it must be in the form of key=value", $keyValuePair));
            }
            if (isset($ruleOptions[$key])) {
                if (!($isArray && is_array($ruleOptions[$key]))) {
                    throw new Exception(sprintf("Duplicated rule option '%s'", $key));
                }
                $ruleOptions[$key][] = $value;
            } else {
                $ruleOptions[$key] = $isArray ? ((array) $value) : $value;
            }
        }

        return $ruleOptions;
    }
protected function parseRuleOptions ( InputInterface $ input ) { $ ruleOptions = [ ] ; foreach ( $ input -> getArgument ( 'rule-options' ) as $ keyValuePair ) { list ( $ key , $ value ) = explode ( '=' , $ keyValuePair , 2 ) ; $ key = trim ( $ key ) ; if ( substr ( $ key , - 2 ) === '[]' ) { $ isArray = true ; $ key = rtrim ( substr ( $ key , 0 , - 2 ) ) ; } else { $ isArray = false ; } if ( $ key === '' || ! isset ( $ value ) ) { throw new Exception ( sprintf ( "Unable to parse the rule option '%s': it must be in the form of key=value" , $ keyValuePair ) ) ; } if ( isset ( $ ruleOptions [ $ key ] ) ) { if ( ! ( $ isArray && is_array ( $ ruleOptions [ $ key ] ) ) ) { throw new Exception ( sprintf ( "Duplicated rule option '%s'" , $ key ) ) ; } $ ruleOptions [ $ key ] [ ] = $ value ; } else { $ ruleOptions [ $ key ] = $ isArray ? ( ( array ) $ value ) : $ value ; } } return $ ruleOptions ; }
Parse the rule-options input argument.

@param InputInterface $input

@throws Exception

@return array
Parse the rule - options input argument .