| 1 | <?php |
||
| 18 | abstract class Http |
||
| 19 | { |
||
| 20 | const HEAD = 'HEAD'; |
||
| 21 | const GET = 'GET'; |
||
| 22 | const POST = 'POST'; |
||
| 23 | const PUT = 'PUT'; |
||
| 24 | const DELETE = 'DELETE'; |
||
| 25 | const PATCH = 'PATCH'; |
||
| 26 | const OPTIONS = 'OPTIONS'; |
||
| 27 | const TRACE = 'TRACE'; |
||
| 28 | public static $methods = array( |
||
| 29 | 'HEAD' => self::HEAD, |
||
| 30 | 'GET' => self::GET, |
||
| 31 | 'POST' => self::POST, |
||
| 32 | 'PUT' => self::PUT, |
||
| 33 | 'DELETE' => self::DELETE, |
||
| 34 | 'PATCH' => self::PATCH, |
||
| 35 | 'OPTIONS' => self::OPTIONS, |
||
| 36 | 'TRACE' => self::TRACE, |
||
| 37 | ); |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @param $uri |
||
| 41 | * @param null $payload |
||
| 42 | * @param array $options |
||
| 43 | * @return mixed |
||
| 44 | */ |
||
| 45 | abstract function post($uri, $payload = null, array $options = array()); |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @param $uri |
||
| 49 | * @param null $payload |
||
| 50 | * @param array $options |
||
| 51 | * @return mixed |
||
| 52 | */ |
||
| 53 | abstract function patch($uri, $payload = null, array $options = array()); |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @param $uri |
||
| 57 | * @param null $payload |
||
| 58 | * @param array $options |
||
| 59 | * @return mixed |
||
| 60 | */ |
||
| 61 | abstract function put($uri, $payload = null, array $options = array()); |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @param $uri |
||
| 65 | * @param array $options |
||
| 66 | * @return mixed |
||
| 67 | */ |
||
| 68 | abstract function get($uri, array $options = array()); |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @param $uri |
||
| 72 | * @param array $options |
||
| 73 | * @return mixed |
||
| 74 | */ |
||
| 75 | abstract function head($uri, array $options = array()); |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @param $uri |
||
| 79 | * @param array $options |
||
| 80 | * @return mixed |
||
| 81 | */ |
||
| 82 | abstract function delete($uri, array $options = array()); |
||
| 83 | |||
| 84 | /** |
||
| 85 | * @param $uri |
||
| 86 | * @param array $options |
||
| 87 | * @return mixed |
||
| 88 | */ |
||
| 89 | abstract function options($uri, array $options = array()); |
||
| 90 | |||
| 91 | /** |
||
| 92 | * @param $uri |
||
| 93 | * @param array $options |
||
| 94 | * @return mixed |
||
| 95 | */ |
||
| 96 | abstract function trace($uri, array $options = array()); |
||
| 97 | |||
| 98 | /** |
||
| 99 | * @param $method |
||
| 100 | * @return bool |
||
| 101 | */ |
||
| 102 | public static function hasBody($method){ |
||
| 105 | } |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.