method = strtoupper( $method ); $this->route = $route; $this->attributes = $attributes; } /** * Sets parameters from the query string. * * @param array $params Parameter map of key to value. */ public function set_query_params( $params ) { $this->params['GET'] = $params; } /** * Sets parameters from the body. * * @param array $params Parameter map of key to value. */ public function set_body_params( $params ) { $this->params['POST'] = $params; } /** * Retrieves a parameter from the request. * * @param string $key Parameter name. * * @return mixed|null Value if set, null otherwise. */ public function get_param( $key ) { foreach ( [ 'POST', 'GET' ] as $method ) { if ( isset( $this->params[ $method ][ $key ] ) ) { return $this->params[ $method ][ $key ]; } } return null; } } }