1 | <?php |
||
15 | trait Condition |
||
16 | { |
||
17 | /** |
||
18 | * A condition to check before sending this request |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $sCondition = null; |
||
23 | |||
24 | /** |
||
25 | * Add a condition to the request |
||
26 | * |
||
27 | * The request is sent only if the condition is true. |
||
28 | * |
||
29 | * @param string $sCondition The condition to check |
||
30 | * |
||
31 | * @return Request |
||
32 | */ |
||
33 | public function when($sCondition) |
||
38 | |||
39 | /** |
||
40 | * Add a condition to the request |
||
41 | * |
||
42 | * The request is sent only if the condition is false. |
||
43 | * |
||
44 | * @param string $sCondition The condition to check |
||
45 | * |
||
46 | * @return Request |
||
47 | */ |
||
48 | public function unless($sCondition) |
||
53 | |||
54 | /** |
||
55 | * Check if a value is equal to another before sending the request |
||
56 | * |
||
57 | * @param string $sValue1 The first value to compare |
||
58 | * @param string $sValue2 The second value to compare |
||
59 | * |
||
60 | * @return Request |
||
61 | */ |
||
62 | public function ifeq($sValue1, $sValue2) |
||
67 | |||
68 | /** |
||
69 | * Check if a value is not equal to another before sending the request |
||
70 | * |
||
71 | * @param string $sValue1 The first value to compare |
||
72 | * @param string $sValue2 The second value to compare |
||
73 | * |
||
74 | * @return Request |
||
75 | */ |
||
76 | public function ifne($sValue1, $sValue2) |
||
81 | |||
82 | /** |
||
83 | * Check if a value is greater than another before sending the request |
||
84 | * |
||
85 | * @param string $sValue1 The first value to compare |
||
86 | * @param string $sValue2 The second value to compare |
||
87 | * |
||
88 | * @return Request |
||
89 | */ |
||
90 | public function ifgt($sValue1, $sValue2) |
||
95 | |||
96 | /** |
||
97 | * Check if a value is greater or equal to another before sending the request |
||
98 | * |
||
99 | * @param string $sValue1 The first value to compare |
||
100 | * @param string $sValue2 The second value to compare |
||
101 | * |
||
102 | * @return Request |
||
103 | */ |
||
104 | public function ifge($sValue1, $sValue2) |
||
109 | |||
110 | /** |
||
111 | * Check if a value is lower than another before sending the request |
||
112 | * |
||
113 | * @param string $sValue1 The first value to compare |
||
114 | * @param string $sValue2 The second value to compare |
||
115 | * |
||
116 | * @return Request |
||
117 | */ |
||
118 | public function iflt($sValue1, $sValue2) |
||
123 | |||
124 | /** |
||
125 | * Check if a value is lower or equal to another before sending the request |
||
126 | * |
||
127 | * @param string $sValue1 The first value to compare |
||
128 | * @param string $sValue2 The second value to compare |
||
129 | * |
||
130 | * @return Request |
||
131 | */ |
||
132 | public function ifle($sValue1, $sValue2) |
||
137 | } |
||
138 |