1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Setup assigned methods |
4
|
|
|
* User: moyo |
5
|
|
|
* Date: 2018/5/29 |
6
|
|
|
* Time: 10:53 AM |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace Carno\Web\Chips\Router; |
10
|
|
|
|
11
|
|
|
trait STAMethods |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @param string $uri |
15
|
|
|
* @param callable $processor |
16
|
|
|
* @return static |
17
|
|
|
*/ |
18
|
|
|
public function options(string $uri, callable $processor) : self |
19
|
|
|
{ |
20
|
|
|
return $this->add('options', $uri, $processor); |
|
|
|
|
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @param string $uri |
25
|
|
|
* @param callable $processor |
26
|
|
|
* @return static |
27
|
|
|
*/ |
28
|
|
|
public function head(string $uri, callable $processor) : self |
29
|
|
|
{ |
30
|
|
|
return $this->add('head', $uri, $processor); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @param string $uri |
35
|
|
|
* @param callable $processor |
36
|
|
|
* @return static |
37
|
|
|
*/ |
38
|
|
|
public function get(string $uri, callable $processor) : self |
39
|
|
|
{ |
40
|
|
|
return $this->add('get', $uri, $processor); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param string $uri |
45
|
|
|
* @param callable $processor |
46
|
|
|
* @return static |
47
|
|
|
*/ |
48
|
|
|
public function post(string $uri, callable $processor) : self |
49
|
|
|
{ |
50
|
|
|
return $this->add('post', $uri, $processor); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @param string $uri |
55
|
|
|
* @param callable $processor |
56
|
|
|
* @return static |
57
|
|
|
*/ |
58
|
|
|
public function put(string $uri, callable $processor) : self |
59
|
|
|
{ |
60
|
|
|
return $this->add('put', $uri, $processor); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @param string $uri |
65
|
|
|
* @param callable $processor |
66
|
|
|
* @return static |
67
|
|
|
*/ |
68
|
|
|
public function patch(string $uri, callable $processor) : self |
69
|
|
|
{ |
70
|
|
|
return $this->add('patch', $uri, $processor); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @param string $uri |
75
|
|
|
* @param callable $processor |
76
|
|
|
* @return static |
77
|
|
|
*/ |
78
|
|
|
public function delete(string $uri, callable $processor) : self |
79
|
|
|
{ |
80
|
|
|
return $this->add('delete', $uri, $processor); |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|