1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- class KO7_HTTP_Exception_405 extends HTTP_Exception_Expected {
- /**
- * @var integer HTTP 405 Method Not Allowed
- */
- protected $_code = 405;
- /**
- * Specifies the list of allowed HTTP methods
- *
- * @param array $methods List of allowed methods
- */
- public function allowed($methods)
- {
- if (is_array($methods))
- {
- $methods = implode(',', $methods);
- }
- $this->headers('allow', $methods);
- return $this;
- }
- /**
- * Validate this exception contains everything needed to continue.
- *
- * @throws KO7_Exception
- * @return bool
- */
- public function check()
- {
- if ($this->headers('allow') === NULL)
- throw new KO7_Exception('A list of allowed methods must be specified');
- return TRUE;
- }
- }
|