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;
    }