src/Router.php
public function pattern($pattern, $attr = null)
    {
        if (is_array($pattern)) {
            foreach ($pattern as $key => $value) {
                if (! in_array('{' . $key . '}', array_keys($this->patterns))) {
                    $this->patterns['{' . $key . '}'] = '(' . $value . ')';
                } else {
                    return $this->exception($key . ' pattern cannot be changed.');
                }
            }
        } else {
            if (! in_array('{' . $pattern . '}', array_keys($this->patterns))) {
                $this->patterns['{' . $pattern . '}'] = '(' . $attr . ')';
            } else {
                return $this->exception($pattern . ' pattern cannot be changed.');
            }
        }

        return true;
    }
public function pattern($pattern, $attr = null)
    {
        if (is_array($pattern)) {
            foreach ($pattern as $key => $value) {
                if (! in_array('{' . $key . '}', array_keys($this->patterns))) {
                    $this->patterns['{' . $key . '}'] = '(' . $value . ')';
                } else {
                    return $this->exception($key . ' pattern cannot be changed.');
                }
            }
        } else {
            if (! in_array('{' . $pattern . '}', array_keys($this->patterns))) {
                $this->patterns['{' . $pattern . '}'] = '(' . $attr . ')';
            } else {
                return $this->exception($pattern . ' pattern cannot be changed.');
            }
        }

        return true;
    }
public function pattern ( $ pattern , $ attr = null ) { if ( is_array ( $ pattern ) ) { foreach ( $ pattern as $ key => $ value ) { if ( ! in_array ( '{' . $ key . '}' , array_keys ( $ this -> patterns ) ) ) { $ this -> patterns [ '{' . $ key . '}' ] = '(' . $ value . ')' ; } else { return $ this -> exception ( $ key . ' pattern cannot be changed.' ) ; } } } else { if ( ! in_array ( '{' . $ pattern . '}' , array_keys ( $ this -> patterns ) ) ) { $ this -> patterns [ '{' . $ pattern . '}' ] = '(' . $ attr . ')' ; } else { return $ this -> exception ( $ pattern . ' pattern cannot be changed.' ) ; } } return true ; }
Add new route rules pattern; String or Array

@param string|array $pattern
@param null|string $attr

@return mixed
@throws
Add new route rules pattern ; String or Array