protected function getParamValue($param, $paramOptions, $value)
    {
        if (! empty($paramOptions['arguments'])) {
            $ret = array();
            foreach ($paramOptions['arguments'] as $arg => $opts) {
                $p = $arg;
                if (! empty($opts['alias'])) {
                    $alias = implode('|', (array) $opts['alias']);
                    $p .= "|\\b{$alias}";
                }
                $regex = "(\\b{$p})\\[(.*?)\\]";
                if (preg_match("%{$regex}%", $value, $match)) {
                    $ret[$arg] = $this->getParamValue($arg, $opts, $match[2]);
                }
            }

            return $ret;
        } else {
            // Using RegEx?
            if (! empty($paramOptions['regex'])) {
                if (! preg_match("%^(?:{$paramOptions['regex']})$%", $value)) {
                    throw new ErrorException("'{$value}' is not a valid value for: {$param}");
                }
            }

            $cast = ! empty($paramOptions['cast']) ? $paramOptions['cast'] : 'string';

            return $this->castValue($cast, $value);
        }
    }
protected function getParamValue($param, $paramOptions, $value)
    {
        if (! empty($paramOptions['arguments'])) {
            $ret = array();
            foreach ($paramOptions['arguments'] as $arg => $opts) {
                $p = $arg;
                if (! empty($opts['alias'])) {
                    $alias = implode('|', (array) $opts['alias']);
                    $p .= "|\\b{$alias}";
                }
                $regex = "(\\b{$p})\\[(.*?)\\]";
                if (preg_match("%{$regex}%", $value, $match)) {
                    $ret[$arg] = $this->getParamValue($arg, $opts, $match[2]);
                }
            }

            return $ret;
        } else {
            // Using RegEx?
            if (! empty($paramOptions['regex'])) {
                if (! preg_match("%^(?:{$paramOptions['regex']})$%", $value)) {
                    throw new ErrorException("'{$value}' is not a valid value for: {$param}");
                }
            }

            $cast = ! empty($paramOptions['cast']) ? $paramOptions['cast'] : 'string';

            return $this->castValue($cast, $value);
        }
    }
protected function getParamValue ( $ param , $ paramOptions , $ value ) { if ( ! empty ( $ paramOptions [ 'arguments' ] ) ) { $ ret = array ( ) ; foreach ( $ paramOptions [ 'arguments' ] as $ arg => $ opts ) { $ p = $ arg ; if ( ! empty ( $ opts [ 'alias' ] ) ) { $ alias = implode ( '|' , ( array ) $ opts [ 'alias' ] ) ; $ p .= "|\\b{$alias}" ; } $ regex = "(\\b{$p})\\[(.*?)\\]" ; if ( preg_match ( "%{$regex}%" , $ value , $ match ) ) { $ ret [ $ arg ] = $ this -> getParamValue ( $ arg , $ opts , $ match [ 2 ] ) ; } } return $ ret ; } else { // Using RegEx? if ( ! empty ( $ paramOptions [ 'regex' ] ) ) { if ( ! preg_match ( "%^(?:{$paramOptions['regex']})$%" , $ value ) ) { throw new ErrorException ( "'{$value}' is not a valid value for: {$param}" ) ; } } $ cast = ! empty ( $ paramOptions [ 'cast' ] ) ? $ paramOptions [ 'cast' ] : 'string' ; return $ this -> castValue ( $ cast , $ value ) ; } }
Grabs a value from a param by running it through supplied regex

@param $param
@param $paramOptions
@param $value

@return string|array

@throws \Munee\ErrorException
Grabs a value from a param by running it through supplied regex