Completed
Push — master ( 04748f...585c72 )
by Marco
07:11
created
src/Comodojo/Cookies/AbstractCookie.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -297,13 +297,13 @@
 block discarded – undo
297 297
     /**
298 298
      * Set content of $cookie from array $properties
299 299
      *
300
-     * @param   \Comodojo\Cookies\CookieInterface\CookieInterface   $cookie
300
+     * @param   CookieInterface   $cookie
301 301
      *
302 302
      * @param   array    $properties    Array of properties cookie should have
303 303
      *
304 304
      * @param   boolean  $serialize
305 305
      *
306
-     * @return  \Comodojo\Cookies\CookieBase
306
+     * @return  CookieInterface
307 307
      */
308 308
     protected static function cookieProperties(CookieInterface $cookie, $properties, $serialize) {
309 309
 
Please login to merge, or discard this patch.
Braces   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * THE SOFTWARE.
21 21
  */
22 22
 
23
-abstract class AbstractCookie implements CookieInterface {
23
+abstract class AbstractCookie implements CookieInterface {
24 24
 
25 25
     /**
26 26
      * The cookie name
@@ -88,19 +88,19 @@  discard block
 block discarded – undo
88 88
      *
89 89
      * @throws CookieException
90 90
      */
91
-    public function __construct($name, $max_cookie_size = null) {
91
+    public function __construct($name, $max_cookie_size = null) {
92 92
 
93
-        try {
93
+        try {
94 94
 
95 95
             $this->setName($name);
96 96
 
97
-        } catch (CookieException $ce) {
97
+        } catch (CookieException $ce) {
98 98
 
99 99
             throw $ce;
100 100
 
101 101
         }
102 102
 
103
-        if ( is_int($max_cookie_size) ) {
103
+        if ( is_int($max_cookie_size) ) {
104 104
 
105 105
             $this->max_cookie_size = filter_var($max_cookie_size, FILTER_VALIDATE_INT, array(
106 106
                 'options' => array(
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     /**
116 116
      * {@inheritdoc}
117 117
      */
118
-    public function setName($name) {
118
+    public function setName($name) {
119 119
 
120 120
         if ( empty($name) || !is_scalar($name) ) throw new CookieException("Invalid cookie name");
121 121
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     /**
129 129
      * {@inheritdoc}
130 130
      */
131
-    public function getName() {
131
+    public function getName() {
132 132
 
133 133
         return $this->name;
134 134
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     /**
148 148
      * {@inheritdoc}
149 149
      */
150
-    public function setExpire($timestamp) {
150
+    public function setExpire($timestamp) {
151 151
 
152 152
         if ( !is_int($timestamp) ) throw new CookieException("Invalud cookie's expiration time");
153 153
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     /**
161 161
      * {@inheritdoc}
162 162
      */
163
-    public function setPath($location) {
163
+    public function setPath($location) {
164 164
 
165 165
         if ( !is_string($location) ) throw new CookieException("Invalid path attribute");
166 166
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     /**
174 174
      * {@inheritdoc}
175 175
      */
176
-    public function setDomain($domain) {
176
+    public function setDomain($domain) {
177 177
 
178 178
         if ( !is_scalar($domain) || !self::checkDomain($domain) ) throw new CookieException("Invalid domain attribute");
179 179
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     /**
187 187
      * {@inheritdoc}
188 188
      */
189
-    public function setSecure($mode = true) {
189
+    public function setSecure($mode = true) {
190 190
 
191 191
         $this->secure = filter_var($mode, FILTER_VALIDATE_BOOLEAN);
192 192
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     /**
198 198
      * {@inheritdoc}
199 199
      */
200
-    public function setHttponly($mode = true) {
200
+    public function setHttponly($mode = true) {
201 201
 
202 202
         $this->httponly = filter_var($mode, FILTER_VALIDATE_BOOLEAN);
203 203
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
     /**
209 209
      * {@inheritdoc}
210 210
      */
211
-    public function save() {
211
+    public function save() {
212 212
 
213 213
         if ( setcookie(
214 214
             $this->name,
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     /**
228 228
      * {@inheritdoc}
229 229
      */
230
-    public function load() {
230
+    public function load() {
231 231
 
232 232
         if ( !$this->exists() ) throw new CookieException("Cookie does not exists");
233 233
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     /**
241 241
      * {@inheritdoc}
242 242
      */
243
-    public function delete() {
243
+    public function delete() {
244 244
 
245 245
         if ( !$this->exists() ) return true;
246 246
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     /**
262 262
      * {@inheritdoc}
263 263
      */
264
-    public function exists() {
264
+    public function exists() {
265 265
 
266 266
         return isset($_COOKIE[$this->name]);
267 267
 
@@ -276,15 +276,15 @@  discard block
 block discarded – undo
276 276
      *
277 277
      * @throws  \Comodojo\Exception\CookieException
278 278
      */
279
-    public static function erase($name) {
279
+    public static function erase($name) {
280 280
 
281
-        try {
281
+        try {
282 282
 
283 283
             $cookie = new Cookie($name);
284 284
 
285 285
             $return = $cookie->delete();
286 286
 
287
-        } catch (CookieException $ce) {
287
+        } catch (CookieException $ce) {
288 288
 
289 289
             throw $ce;
290 290
 
@@ -305,11 +305,11 @@  discard block
 block discarded – undo
305 305
      *
306 306
      * @return  \Comodojo\Cookies\CookieBase
307 307
      */
308
-    protected static function cookieProperties(CookieInterface $cookie, $properties, $serialize) {
308
+    protected static function cookieProperties(CookieInterface $cookie, $properties, $serialize) {
309 309
 
310
-        foreach ( $properties as $property => $value ) {
310
+        foreach ( $properties as $property => $value ) {
311 311
 
312
-            switch ( $property ) {
312
+            switch ( $property ) {
313 313
 
314 314
                 case 'value':
315 315
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
      *
365 365
      * @return  bool
366 366
      */
367
-    protected static function checkDomain($domain_name) {
367
+    protected static function checkDomain($domain_name) {
368 368
 
369 369
         if ( $domain_name[0] == '.' ) $domain_name = substr($domain_name, 1);
370 370
 
Please login to merge, or discard this patch.
src/Comodojo/Cookies/CookieManager.php 1 patch
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      *
87 87
      * @param CookieInterface|string $cookie
88 88
      *
89
-     * @return static
89
+     * @return boolean
90 90
      */
91 91
     public function has($cookie) {
92 92
 
@@ -101,6 +101,7 @@  discard block
 block discarded – undo
101 101
     /**
102 102
      * @deprecated 2.1.0
103 103
      * @see CookieManager::has()
104
+     * @param string $cookie
104 105
      */
105 106
     public function isRegistered($cookie) {
106 107
         return $this->has($cookie);
@@ -151,7 +152,7 @@  discard block
 block discarded – undo
151 152
     /**
152 153
      * Save all registered cookies
153 154
      *
154
-     * @return static
155
+     * @return boolean
155 156
      */
156 157
     public function save() {
157 158
 
Please login to merge, or discard this patch.
src/Comodojo/Cookies/EncryptedCookie.php 1 patch
Braces   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * THE SOFTWARE.
22 22
  */
23 23
 
24
-class EncryptedCookie extends AbstractCookie {
24
+class EncryptedCookie extends AbstractCookie {
25 25
 
26 26
     /*
27 27
      * AES key
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      *
42 42
      * @throws \Comodojo\Exception\CookieException
43 43
      */
44
-    public function __construct($name, $key, $max_cookie_size = null) {
44
+    public function __construct($name, $key, $max_cookie_size = null) {
45 45
 
46 46
         if ( empty($key) OR !is_scalar($key) ) throw new CookieException("Invalid secret key");
47 47
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      *
60 60
      * @throws  \Comodojo\Exception\CookieException
61 61
      */
62
-    public function setValue($value, $serialize = true) {
62
+    public function setValue($value, $serialize = true) {
63 63
 
64 64
         if ( !is_scalar($value) && $serialize === false ) throw new CookieException("Cannot set non-scalar value without serialization");
65 65
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @return  mixed
92 92
      */
93
-    public function getValue($unserialize = true) {
93
+    public function getValue($unserialize = true) {
94 94
 
95 95
         $cipher = new AES(AES::MODE_ECB);
96 96
 
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
      *
126 126
      * @throws  \Comodojo\Exception\CookieException
127 127
      */
128
-    public static function create($name, $key, $properties = [], $serialize = true) {
128
+    public static function create($name, $key, $properties = [], $serialize = true) {
129 129
 
130
-        try {
130
+        try {
131 131
 
132 132
             $class = get_called_class();
133 133
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
             self::cookieProperties($cookie, $properties, $serialize);
137 137
 
138
-        } catch (CookieException $ce) {
138
+        } catch (CookieException $ce) {
139 139
 
140 140
             throw $ce;
141 141
 
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
      *
157 157
      * @throws  \Comodojo\Exception\CookieException
158 158
      */
159
-    public static function retrieve($name, $key) {
159
+    public static function retrieve($name, $key) {
160 160
 
161
-        try {
161
+        try {
162 162
 
163 163
             $class = get_called_class();
164 164
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
             $return = $cookie->load();
168 168
 
169
-        } catch (CookieException $ce) {
169
+        } catch (CookieException $ce) {
170 170
 
171 171
             throw $ce;
172 172
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      *
184 184
      * @return  string
185 185
      */
186
-    protected static function encryptKey($key) {
186
+    protected static function encryptKey($key) {
187 187
 
188 188
         return hash('sha256', $key);
189 189
 
Please login to merge, or discard this patch.