GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 1de6d8...a418b8 )
by
unknown
02:26
created
src/autoload.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
  * @param $className
17 17
  */
18 18
 spl_autoload_register(
19
-    function ($className) {
19
+    function($className) {
20 20
         if ($className === 'O2System\Session') {
21 21
             require __DIR__ . DIRECTORY_SEPARATOR . 'Session.php';
22 22
         } elseif (strpos($className, 'O2System\Session\\') === false) {
Please login to merge, or discard this patch.
src/Session.php 1 patch
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      */
113 113
     public function setLogger(LoggerInterface $logger)
114 114
     {
115
-        $this->logger =& $logger;
115
+        $this->logger = & $logger;
116 116
 
117 117
         // Load Session Language
118 118
         language()->loadFile('session');
@@ -156,12 +156,12 @@  discard block
 block discarded – undo
156 156
         session_set_save_handler($this->handler, true);
157 157
 
158 158
         // Sanitize the cookie, because apparently PHP doesn't do that for userspace handlers
159
-        if (isset($_COOKIE[ $this->config[ 'name' ] ]) && (
160
-                ! is_string($_COOKIE[ $this->config[ 'name' ] ]) || ! preg_match('#\A' . $this->sidRegexp . '\z#',
161
-                    $_COOKIE[ $this->config[ 'name' ] ])
159
+        if (isset($_COOKIE[$this->config['name']]) && (
160
+                ! is_string($_COOKIE[$this->config['name']]) || ! preg_match('#\A' . $this->sidRegexp . '\z#',
161
+                    $_COOKIE[$this->config['name']])
162 162
             )
163 163
         ) {
164
-            unset($_COOKIE[ $this->config[ 'name' ] ]);
164
+            unset($_COOKIE[$this->config['name']]);
165 165
         }
166 166
 
167 167
         session_start();
@@ -169,38 +169,38 @@  discard block
 block discarded – undo
169 169
         $this->initializeVariables();
170 170
 
171 171
         // Sanitize the cookie, because apparently PHP doesn't do that for userspace handlers
172
-        if (isset($_COOKIE[$this->config[ 'name' ]]) && (
173
-                    ! is_string($this->config[ 'name' ]) ||
174
-                    ! preg_match('#\A' . $this->sidRegexp . '\z#', $_COOKIE[$this->config[ 'name' ]]
172
+        if (isset($_COOKIE[$this->config['name']]) && (
173
+                    ! is_string($this->config['name']) ||
174
+                    ! preg_match('#\A' . $this->sidRegexp . '\z#', $_COOKIE[$this->config['name']]
175 175
                 )
176 176
             )
177 177
         )
178 178
         {
179
-            unset($_COOKIE[$this->config[ 'name' ]]);
179
+            unset($_COOKIE[$this->config['name']]);
180 180
         }
181 181
 
182 182
         // Is session ID auto-regeneration configured? (ignoring ajax requests)
183
-        if ((empty($_SERVER[ 'HTTP_X_REQUESTED_WITH' ]) ||
184
-                strtolower($_SERVER[ 'HTTP_X_REQUESTED_WITH' ]) !== 'xmlhttprequest') &&
185
-            ($regenerateTime = $this->config[ 'regenerate' ]->lifetime) > 0
183
+        if ((empty($_SERVER['HTTP_X_REQUESTED_WITH']) ||
184
+                strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) !== 'xmlhttprequest') &&
185
+            ($regenerateTime = $this->config['regenerate']->lifetime) > 0
186 186
         ) {
187
-            if ( ! isset($_SESSION[ 'last_regenerate' ])) {
188
-                $_SESSION[ 'last_regenerate' ] = time();
189
-            } elseif ($_SESSION[ 'last_regenerate' ] < (time() - $regenerateTime)) {
187
+            if ( ! isset($_SESSION['last_regenerate'])) {
188
+                $_SESSION['last_regenerate'] = time();
189
+            } elseif ($_SESSION['last_regenerate'] < (time() - $regenerateTime)) {
190 190
                 $this->regenerate();
191 191
             }
192 192
         }
193 193
         // Another work-around ... PHP doesn't seem to send the session cookie
194 194
         // unless it is being currently created or regenerated
195
-        elseif (isset($_COOKIE[ $this->config[ 'name' ] ]) && $_COOKIE[ $this->config[ 'name' ] ] === session_id()
195
+        elseif (isset($_COOKIE[$this->config['name']]) && $_COOKIE[$this->config['name']] === session_id()
196 196
         ) {
197 197
             setcookie(
198
-                $this->config[ 'name' ],
198
+                $this->config['name'],
199 199
                 session_id(),
200
-                (empty($this->config[ 'lifetime' ]) ? 0 : time() + $this->config[ 'lifetime' ]),
201
-                $this->config[ 'cookie' ]->path,
202
-                '.' . ltrim($this->config[ 'cookie' ]->domain, '.'),
203
-                $this->config[ 'cookie' ]->secure,
200
+                (empty($this->config['lifetime']) ? 0 : time() + $this->config['lifetime']),
201
+                $this->config['cookie']->path,
202
+                '.' . ltrim($this->config['cookie']->domain, '.'),
203
+                $this->config['cookie']->secure,
204 204
                 true
205 205
             );
206 206
         }
@@ -223,20 +223,20 @@  discard block
 block discarded – undo
223 223
     {
224 224
         ini_set('session.name', $this->config['name']);
225 225
 
226
-        if (empty($this->config[ 'lifetime' ])) {
227
-            $this->config[ 'lifetime' ] = (int)ini_get('session.gc_maxlifetime');
226
+        if (empty($this->config['lifetime'])) {
227
+            $this->config['lifetime'] = (int)ini_get('session.gc_maxlifetime');
228 228
         } else {
229
-            ini_set('session.gc_maxlifetime', (int)$this->config[ 'lifetime' ]);
229
+            ini_set('session.gc_maxlifetime', (int)$this->config['lifetime']);
230 230
         }
231 231
 
232
-        if (empty($this->config[ 'cookie' ]->domain)) {
233
-            $this->config[ 'cookie' ]->domain = (isset($_SERVER[ 'HTTP_HOST' ]) ? $_SERVER[ 'HTTP_HOST' ]
234
-                : (isset($_SERVER[ 'SERVER_NAME' ]) ? $_SERVER[ 'SERVER_NAME' ] : null));
232
+        if (empty($this->config['cookie']->domain)) {
233
+            $this->config['cookie']->domain = (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST']
234
+                : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : null));
235 235
         }
236 236
 
237
-        $this->config[ 'cookie' ]->domain = ltrim($this->config[ 'cookie' ]->domain, '.');
237
+        $this->config['cookie']->domain = ltrim($this->config['cookie']->domain, '.');
238 238
 
239
-        ini_set('session.cookie_domain','.' . $this->config['cookie']->domain);
239
+        ini_set('session.cookie_domain', '.' . $this->config['cookie']->domain);
240 240
         ini_set('session.cookie_path', $this->config['cookie']->path);
241 241
 
242 242
         // Security is king
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
      */
341 341
     public function regenerate()
342 342
     {
343
-        $_SESSION[ 'last_regenerate' ] = time();
343
+        $_SESSION['last_regenerate'] = time();
344 344
         session_regenerate_id($this->config['regenerate']->destroy);
345 345
     }
346 346
 
@@ -356,25 +356,25 @@  discard block
 block discarded – undo
356 356
      */
357 357
     private function initializeVariables()
358 358
     {
359
-        if ( empty($_SESSION[ 'system_variables' ])) {
359
+        if (empty($_SESSION['system_variables'])) {
360 360
             return;
361 361
         }
362 362
 
363 363
         $currentTime = time();
364 364
 
365
-        foreach ($_SESSION[ 'system_variables' ] as $key => &$value) {
365
+        foreach ($_SESSION['system_variables'] as $key => &$value) {
366 366
             if ($value === 'new') {
367
-                $_SESSION[ 'system_variables' ][ $key ] = 'old';
367
+                $_SESSION['system_variables'][$key] = 'old';
368 368
             }
369 369
             // Hacky, but 'old' will (implicitly) always be less than time() ;)
370 370
             // DO NOT move this above the 'new' check!
371 371
             elseif ($value < $currentTime) {
372
-                unset($_SESSION[ $key ], $_SESSION[ 'system_variables' ][ $key ]);
372
+                unset($_SESSION[$key], $_SESSION['system_variables'][$key]);
373 373
             }
374 374
         }
375 375
 
376
-        if (empty($_SESSION[ 'system_variables' ])) {
377
-            unset($_SESSION[ 'system_variables' ]);
376
+        if (empty($_SESSION['system_variables'])) {
377
+            unset($_SESSION['system_variables']);
378 378
         }
379 379
     }
380 380
 
@@ -390,12 +390,12 @@  discard block
 block discarded – undo
390 390
     public function stop()
391 391
     {
392 392
         setcookie(
393
-            $this->config[ 'name' ],
393
+            $this->config['name'],
394 394
             session_id(),
395 395
             1,
396
-            $this->config[ 'cookie' ]->path,
397
-            '.' . ltrim($this->config[ 'cookie' ]->domain, '.'),
398
-            $this->config[ 'cookie' ]->secure,
396
+            $this->config['cookie']->path,
397
+            '.' . ltrim($this->config['cookie']->domain, '.'),
398
+            $this->config['cookie']->secure,
399 399
             true
400 400
         );
401 401
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
      */
455 455
     public function offsetExists($offset)
456 456
     {
457
-        return (bool)isset($_SESSION[ $offset ]);
457
+        return (bool)isset($_SESSION[$offset]);
458 458
     }
459 459
 
460 460
     // ------------------------------------------------------------------------
@@ -489,14 +489,14 @@  discard block
 block discarded – undo
489 489
     public function &__get($offset)
490 490
     {
491 491
         if ($offset === 'id') {
492
-            $_SESSION[ 'id' ] = session_id();
492
+            $_SESSION['id'] = session_id();
493 493
         }
494 494
 
495
-        if ( ! isset($_SESSION[ $offset ])) {
496
-            $_SESSION[ $offset ] = null;
495
+        if ( ! isset($_SESSION[$offset])) {
496
+            $_SESSION[$offset] = null;
497 497
         }
498 498
 
499
-        return $_SESSION[ $offset ];
499
+        return $_SESSION[$offset];
500 500
     }
501 501
 
502 502
     // ------------------------------------------------------------------------
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
      */
537 537
     public function offsetSet($offset, $value)
538 538
     {
539
-        $_SESSION[ $offset ] =& $value;
539
+        $_SESSION[$offset] = & $value;
540 540
     }
541 541
 
542 542
     // ------------------------------------------------------------------------
@@ -574,8 +574,8 @@  discard block
 block discarded – undo
574 574
      */
575 575
     public function offsetUnset($offset)
576 576
     {
577
-        if (isset($_SESSION[ $offset ])) {
578
-            unset($_SESSION[ $offset ]);
577
+        if (isset($_SESSION[$offset])) {
578
+            unset($_SESSION[$offset]);
579 579
         }
580 580
     }
581 581
 
@@ -638,13 +638,13 @@  discard block
 block discarded – undo
638 638
     {
639 639
         if (is_array($offset)) {
640 640
             foreach ($offset as $key => &$value) {
641
-                $_SESSION[ $key ] = $value;
641
+                $_SESSION[$key] = $value;
642 642
             }
643 643
 
644 644
             return;
645 645
         }
646 646
 
647
-        $_SESSION[ $offset ] =& $value;
647
+        $_SESSION[$offset] = & $value;
648 648
     }
649 649
 
650 650
     //--------------------------------------------------------------------
@@ -662,26 +662,26 @@  discard block
 block discarded – undo
662 662
     {
663 663
         if (is_array($offset)) {
664 664
             for ($i = 0, $c = count($offset); $i < $c; $i++) {
665
-                if ( ! isset($_SESSION[ $offset[ $i ] ])) {
665
+                if ( ! isset($_SESSION[$offset[$i]])) {
666 666
                     return false;
667 667
                 }
668 668
             }
669 669
 
670 670
             $new = array_fill_keys($offset, 'new');
671 671
 
672
-            $_SESSION[ 'system_variables' ] = isset($_SESSION[ 'system_variables' ]) ? array_merge(
673
-                $_SESSION[ 'system_variables' ],
672
+            $_SESSION['system_variables'] = isset($_SESSION['system_variables']) ? array_merge(
673
+                $_SESSION['system_variables'],
674 674
                 $new
675 675
             ) : $new;
676 676
 
677 677
             return true;
678 678
         }
679 679
 
680
-        if ( ! isset($_SESSION[ $offset ])) {
680
+        if ( ! isset($_SESSION[$offset])) {
681 681
             return false;
682 682
         }
683 683
 
684
-        $_SESSION[ 'system_variables' ][ $offset ] = 'new';
684
+        $_SESSION['system_variables'][$offset] = 'new';
685 685
 
686 686
         return true;
687 687
     }
@@ -719,10 +719,10 @@  discard block
 block discarded – undo
719 719
     public function offsetGet($offset)
720 720
     {
721 721
         if ($offset === 'id') {
722
-            $_SESSION[ 'id' ] = session_id();
722
+            $_SESSION['id'] = session_id();
723 723
         }
724 724
 
725
-        return (isset($_SESSION[ $offset ])) ? $_SESSION[ $offset ] : false;
725
+        return (isset($_SESSION[$offset])) ? $_SESSION[$offset] : false;
726 726
     }
727 727
 
728 728
     //--------------------------------------------------------------------
@@ -740,15 +740,15 @@  discard block
 block discarded – undo
740 740
     public function getFlash($offset = null)
741 741
     {
742 742
         if (isset($offset)) {
743
-            return (isset($_SESSION[ 'system_variables' ], $_SESSION[ 'system_variables' ][ $offset ], $_SESSION[ $offset ]) &&
744
-                ! is_int($_SESSION[ 'system_variables' ][ $offset ])) ? $_SESSION[ $offset ] : null;
743
+            return (isset($_SESSION['system_variables'], $_SESSION['system_variables'][$offset], $_SESSION[$offset]) &&
744
+                ! is_int($_SESSION['system_variables'][$offset])) ? $_SESSION[$offset] : null;
745 745
         }
746 746
 
747 747
         $flashVariables = [];
748 748
 
749
-        if ( ! empty($_SESSION[ 'system_variables' ])) {
750
-            foreach ($_SESSION[ 'system_variables' ] as $offset => &$value) {
751
-                is_int($value) OR $flashVariables[ $offset ] = $_SESSION[ $offset ];
749
+        if ( ! empty($_SESSION['system_variables'])) {
750
+            foreach ($_SESSION['system_variables'] as $offset => &$value) {
751
+                is_int($value) OR $flashVariables[$offset] = $_SESSION[$offset];
752 752
             }
753 753
         }
754 754
 
@@ -780,23 +780,23 @@  discard block
 block discarded – undo
780 780
      */
781 781
     public function unsetFlash($offset)
782 782
     {
783
-        if (empty($_SESSION[ 'system_variables' ])) {
783
+        if (empty($_SESSION['system_variables'])) {
784 784
             return;
785 785
         }
786 786
 
787 787
         is_array($offset) OR $offset = [$offset];
788 788
 
789 789
         foreach ($offset as $key) {
790
-            if (isset($_SESSION[ 'system_variables' ][ $key ]) && ! is_int(
791
-                    $_SESSION[ 'system_variables' ][ $key ]
790
+            if (isset($_SESSION['system_variables'][$key]) && ! is_int(
791
+                    $_SESSION['system_variables'][$key]
792 792
                 )
793 793
             ) {
794
-                unset($_SESSION[ 'system_variables' ][ $key ]);
794
+                unset($_SESSION['system_variables'][$key]);
795 795
             }
796 796
         }
797 797
 
798
-        if (empty($_SESSION[ 'system_variables' ])) {
799
-            unset($_SESSION[ 'system_variables' ]);
798
+        if (empty($_SESSION['system_variables'])) {
799
+            unset($_SESSION['system_variables']);
800 800
         }
801 801
     }
802 802
 
@@ -811,13 +811,13 @@  discard block
 block discarded – undo
811 811
      */
812 812
     public function getFlashOffsets()
813 813
     {
814
-        if ( ! isset($_SESSION[ 'system_variables' ])) {
814
+        if ( ! isset($_SESSION['system_variables'])) {
815 815
             return [];
816 816
         }
817 817
 
818 818
         $offsets = [];
819
-        foreach (array_keys($_SESSION[ 'system_variables' ]) as $offset) {
820
-            is_int($_SESSION[ 'system_variables' ][ $offset ]) OR $offsets[] = $offset;
819
+        foreach (array_keys($_SESSION['system_variables']) as $offset) {
820
+            is_int($_SESSION['system_variables'][$offset]) OR $offsets[] = $offset;
821 821
         }
822 822
 
823 823
         return $offsets;
@@ -869,26 +869,26 @@  discard block
 block discarded – undo
869 869
                     $value += time();
870 870
                 }
871 871
 
872
-                if ( ! isset($_SESSION[ $key ])) {
872
+                if ( ! isset($_SESSION[$key])) {
873 873
                     return false;
874 874
                 }
875 875
 
876
-                $temp[ $key ] = $value;
876
+                $temp[$key] = $value;
877 877
             }
878 878
 
879
-            $_SESSION[ 'system_variables' ] = isset($_SESSION[ 'system_variables' ]) ? array_merge(
880
-                $_SESSION[ 'system_variables' ],
879
+            $_SESSION['system_variables'] = isset($_SESSION['system_variables']) ? array_merge(
880
+                $_SESSION['system_variables'],
881 881
                 $temp
882 882
             ) : $temp;
883 883
 
884 884
             return true;
885 885
         }
886 886
 
887
-        if ( ! isset($_SESSION[ $offset ])) {
887
+        if ( ! isset($_SESSION[$offset])) {
888 888
             return false;
889 889
         }
890 890
 
891
-        $_SESSION[ 'system_variables' ][ $offset ] = $ttl;
891
+        $_SESSION['system_variables'][$offset] = $ttl;
892 892
 
893 893
         return true;
894 894
     }
@@ -907,15 +907,15 @@  discard block
 block discarded – undo
907 907
     public function getTemp($offset = null)
908 908
     {
909 909
         if (isset($offset)) {
910
-            return (isset($_SESSION[ 'system_variables' ], $_SESSION[ 'system_variables' ][ $offset ], $_SESSION[ $offset ]) &&
911
-                is_int($_SESSION[ 'system_variables' ][ $offset ])) ? $_SESSION[ $offset ] : null;
910
+            return (isset($_SESSION['system_variables'], $_SESSION['system_variables'][$offset], $_SESSION[$offset]) &&
911
+                is_int($_SESSION['system_variables'][$offset])) ? $_SESSION[$offset] : null;
912 912
         }
913 913
 
914 914
         $tempVariables = [];
915 915
 
916
-        if ( ! empty($_SESSION[ 'system_variables' ])) {
917
-            foreach ($_SESSION[ 'system_variables' ] as $offset => &$value) {
918
-                is_int($value) && $tempVariables[ $offset ] = $_SESSION[ $offset ];
916
+        if ( ! empty($_SESSION['system_variables'])) {
917
+            foreach ($_SESSION['system_variables'] as $offset => &$value) {
918
+                is_int($value) && $tempVariables[$offset] = $_SESSION[$offset];
919 919
             }
920 920
         }
921 921
 
@@ -933,23 +933,23 @@  discard block
 block discarded – undo
933 933
      */
934 934
     public function unsetTemp($offset)
935 935
     {
936
-        if (empty($_SESSION[ 'system_variables' ])) {
936
+        if (empty($_SESSION['system_variables'])) {
937 937
             return;
938 938
         }
939 939
 
940 940
         is_array($offset) OR $offset = [$offset];
941 941
 
942 942
         foreach ($offset as $key) {
943
-            if (isset($_SESSION[ 'system_variables' ][ $key ]) && is_int(
944
-                    $_SESSION[ 'system_variables' ][ $key ]
943
+            if (isset($_SESSION['system_variables'][$key]) && is_int(
944
+                    $_SESSION['system_variables'][$key]
945 945
                 )
946 946
             ) {
947
-                unset($_SESSION[ 'system_variables' ][ $key ]);
947
+                unset($_SESSION['system_variables'][$key]);
948 948
             }
949 949
         }
950 950
 
951
-        if (empty($_SESSION[ 'system_variables' ])) {
952
-            unset($_SESSION[ 'system_variables' ]);
951
+        if (empty($_SESSION['system_variables'])) {
952
+            unset($_SESSION['system_variables']);
953 953
         }
954 954
     }
955 955
 
@@ -964,13 +964,13 @@  discard block
 block discarded – undo
964 964
      */
965 965
     public function getTempOffsets()
966 966
     {
967
-        if ( ! isset($_SESSION[ 'system_variables' ])) {
967
+        if ( ! isset($_SESSION['system_variables'])) {
968 968
             return [];
969 969
         }
970 970
 
971 971
         $offsets = [];
972
-        foreach (array_keys($_SESSION[ 'system_variables' ]) as $offset) {
973
-            is_int($_SESSION[ 'system_variables' ][ $offset ]) && $offsets[] = $offset;
972
+        foreach (array_keys($_SESSION['system_variables']) as $offset) {
973
+            is_int($_SESSION['system_variables'][$offset]) && $offsets[] = $offset;
974 974
         }
975 975
 
976 976
         return $offsets;
Please login to merge, or discard this patch.
src/Datastructures/Config.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -32,33 +32,33 @@  discard block
 block discarded – undo
32 32
     public function __construct(array $config)
33 33
     {
34 34
         // Define Session Name
35
-        $config[ 'name' ] = isset($config[ 'name' ]) ? $config[ 'name' ] : 'o2session';
35
+        $config['name'] = isset($config['name']) ? $config['name'] : 'o2session';
36 36
 
37 37
         // Define Session Match IP
38
-        $config[ 'match' ][ 'ip' ] = isset($config[ 'match' ][ 'ip' ]) ? $config[ 'match' ][ 'ip' ] : false;
38
+        $config['match']['ip'] = isset($config['match']['ip']) ? $config['match']['ip'] : false;
39 39
 
40 40
         // Re-Define Session Name base on Match IP
41
-        $config[ 'name' ] = $config[ 'name' ] . ':' . ($config[ 'match' ][ 'ip' ] ? $_SERVER[ 'REMOTE_ADDR' ] . ':' : '');
42
-        $config[ 'name' ] = rtrim($config[ 'name' ], ':');
41
+        $config['name'] = $config['name'] . ':' . ($config['match']['ip'] ? $_SERVER['REMOTE_ADDR'] . ':' : '');
42
+        $config['name'] = rtrim($config['name'], ':');
43 43
 
44
-        if (isset($config[ 'handler' ])) {
45
-            $config[ 'handler' ] = $config[ 'handler' ] === 'files' ? 'file' : $config[ 'handler' ];
44
+        if (isset($config['handler'])) {
45
+            $config['handler'] = $config['handler'] === 'files' ? 'file' : $config['handler'];
46 46
             // $config[ 'handler' ] = $config[ 'handler' ] === 'memcache' ? 'memcached' : $config[ 'handler' ];
47 47
         }
48 48
 
49
-        if ($config[ 'handler' ] === 'file') {
50
-            if (isset($config[ 'filePath' ])) {
51
-                $config[ 'filePath' ] = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $config[ 'filePath' ]);
49
+        if ($config['handler'] === 'file') {
50
+            if (isset($config['filePath'])) {
51
+                $config['filePath'] = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $config['filePath']);
52 52
 
53
-                if ( ! is_dir($config[ 'filePath' ])) {
53
+                if ( ! is_dir($config['filePath'])) {
54 54
                     if (defined('PATH_CACHE')) {
55
-                        $config[ 'filePath' ] = PATH_CACHE . $config[ 'filePath' ];
55
+                        $config['filePath'] = PATH_CACHE . $config['filePath'];
56 56
                     } else {
57
-                        $config[ 'filePath' ] = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $config[ 'filePath' ];
57
+                        $config['filePath'] = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $config['filePath'];
58 58
                     }
59 59
                 }
60 60
             } elseif (defined('PATH_CACHE')) {
61
-                $config[ 'filePath' ] = PATH_CACHE . 'sessions';
61
+                $config['filePath'] = PATH_CACHE . 'sessions';
62 62
             } else {
63 63
                 $this->path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . implode(
64 64
                         DIRECTORY_SEPARATOR,
@@ -66,36 +66,36 @@  discard block
 block discarded – undo
66 66
                     );
67 67
             }
68 68
 
69
-            $config[ 'filePath' ] = rtrim($config[ 'filePath' ], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
69
+            $config['filePath'] = rtrim($config['filePath'], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
70 70
 
71
-            if ( ! is_writable($config[ 'filePath' ])) {
72
-                if ( ! file_exists($config[ 'filePath' ])) {
73
-                    @mkdir($config[ 'filePath' ], 0777, true);
71
+            if ( ! is_writable($config['filePath'])) {
72
+                if ( ! file_exists($config['filePath'])) {
73
+                    @mkdir($config['filePath'], 0777, true);
74 74
                 }
75 75
             }
76 76
         }
77 77
 
78
-        if (empty($config[ 'cookie' ]) AND php_sapi_name() !== 'cli') {
79
-            $config[ 'cookie' ] = [
78
+        if (empty($config['cookie']) AND php_sapi_name() !== 'cli') {
79
+            $config['cookie'] = [
80 80
                 'name'     => 'o2session',
81 81
                 'lifetime' => 7200,
82
-                'domain'   => isset($_SERVER[ 'HTTP_HOST' ]) ? $_SERVER[ 'HTTP_HOST' ] : $_SERVER[ 'SERVER_NAME' ],
82
+                'domain'   => isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'],
83 83
                 'path'     => '/',
84 84
                 'secure'   => false,
85 85
                 'httpOnly' => false,
86 86
             ];
87 87
         }
88 88
 
89
-        if ( ! isset($config[ 'regenerate' ])) {
90
-            $config[ 'regenerate' ][ 'destroy' ] = false;
91
-            $config[ 'regenerate' ][ 'lifetime' ] = 600;
89
+        if ( ! isset($config['regenerate'])) {
90
+            $config['regenerate']['destroy'] = false;
91
+            $config['regenerate']['lifetime'] = 600;
92 92
         }
93 93
 
94
-        if ( ! isset($config[ 'lifetime' ])) {
95
-            $config[ 'lifetime' ] = $config[ 'cookie' ][ 'lifetime' ];
94
+        if ( ! isset($config['lifetime'])) {
95
+            $config['lifetime'] = $config['cookie']['lifetime'];
96 96
         }
97 97
 
98
-        if( ! isset($config['path']) ) {
98
+        if ( ! isset($config['path'])) {
99 99
             $config['path'] = '/';
100 100
         }
101 101
 
Please login to merge, or discard this patch.
src/Abstracts/AbstractHandler.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     {
98 98
         $this->config = $config;
99 99
         $this->config->offsetUnset('handler');
100
-        $this->setPrefixKey($this->config[ 'name' ]);
100
+        $this->setPrefixKey($this->config['name']);
101 101
     }
102 102
 
103 103
     //--------------------------------------------------------------------
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function setLogger(LoggerInterface $logger)
129 129
     {
130
-        $this->logger =& $logger;
130
+        $this->logger = & $logger;
131 131
     }
132 132
 
133 133
     /**
@@ -313,12 +313,12 @@  discard block
 block discarded – undo
313 313
     protected function destroyCookie()
314 314
     {
315 315
         return setcookie(
316
-            $this->config[ 'name' ],
316
+            $this->config['name'],
317 317
             null,
318 318
             1,
319
-            $this->config[ 'cookie' ]->path,
320
-            '.' . ltrim($this->config[ 'cookie' ]->domain, '.'),
321
-            $this->config[ 'cookie' ]->secure,
319
+            $this->config['cookie']->path,
320
+            '.' . ltrim($this->config['cookie']->domain, '.'),
321
+            $this->config['cookie']->secure,
322 322
             true
323 323
         );
324 324
     }
Please login to merge, or discard this patch.
src/Handlers/MemcacheHandler.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -89,26 +89,26 @@  discard block
 block discarded – undo
89 89
             return false;
90 90
         }
91 91
 
92
-        if (isset($this->config[ 'servers' ])) {
93
-            foreach ($this->config[ 'servers' ] as $server => $setup) {
94
-                isset($setup[ 'port' ]) OR $setup[ 'port' ] = 11211;
95
-                isset($setup[ 'weight' ]) OR $setup[ 'weight' ] = 1;
92
+        if (isset($this->config['servers'])) {
93
+            foreach ($this->config['servers'] as $server => $setup) {
94
+                isset($setup['port']) OR $setup['port'] = 11211;
95
+                isset($setup['weight']) OR $setup['weight'] = 1;
96 96
 
97 97
                 // Third parameter is persistance and defaults to TRUE.
98 98
                 $this->memcache->addServer(
99
-                    $setup[ 'host' ],
100
-                    $setup[ 'port' ],
99
+                    $setup['host'],
100
+                    $setup['port'],
101 101
                     true,
102
-                    $setup[ 'weight' ]
102
+                    $setup['weight']
103 103
                 );
104 104
             }
105 105
         } else {
106 106
             // Third parameter is persistance and defaults to TRUE.
107 107
             $this->memcache->addServer(
108
-                $this->config[ 'host' ],
109
-                $this->config[ 'port' ],
108
+                $this->config['host'],
109
+                $this->config['port'],
110 110
                 true,
111
-                $this->config[ 'weight' ]
111
+                $this->config['weight']
112 112
             );
113 113
         }
114 114
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
                     $this->prefixKey . $session_id,
342 342
                     $session_data,
343 343
                     false,
344
-                    $this->config[ 'lifetime' ]
344
+                    $this->config['lifetime']
345 345
                 )
346 346
                 ) {
347 347
                     $this->fingerprint = $fingerprint;
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
             }
354 354
 
355 355
             return $this->memcache->replace($this->prefixKey . $session_id, $session_data, false,
356
-                $this->config[ 'lifetime' ]);
356
+                $this->config['lifetime']);
357 357
         }
358 358
 
359 359
         return false;
Please login to merge, or discard this patch.
src/Handlers/ApcuHandler.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
             apcu_store($this->lockKey, time(), 300);
284 284
 
285 285
             if ($this->fingerprint !== ($fingerprint = md5($sessionData))) {
286
-                if (apcu_store($this->prefixKey . $session_id, $sessionData, $this->config[ 'lifetime' ])) {
286
+                if (apcu_store($this->prefixKey . $session_id, $sessionData, $this->config['lifetime'])) {
287 287
                     $this->fingerprint = $fingerprint;
288 288
 
289 289
                     return true;
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
                 return false;
293 293
             }
294 294
 
295
-            return apcu_store($this->prefixKey . $session_id, $sessionData, $this->config[ 'lifetime' ]);
295
+            return apcu_store($this->prefixKey . $session_id, $sessionData, $this->config['lifetime']);
296 296
         }
297 297
 
298 298
         return false;
Please login to merge, or discard this patch.
src/Handlers/ApcHandler.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
             apc_store($this->lockKey, time(), 300);
284 284
 
285 285
             if ($this->fingerprint !== ($fingerprint = md5($sessionData))) {
286
-                if (apc_store($this->prefixKey . $session_id, $sessionData, $this->config[ 'lifetime' ])) {
286
+                if (apc_store($this->prefixKey . $session_id, $sessionData, $this->config['lifetime'])) {
287 287
                     $this->fingerprint = $fingerprint;
288 288
 
289 289
                     return true;
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
                 return false;
293 293
             }
294 294
 
295
-            return apc_store($this->prefixKey . $session_id, $sessionData, $this->config[ 'lifetime' ]);
295
+            return apc_store($this->prefixKey . $session_id, $sessionData, $this->config['lifetime']);
296 296
         }
297 297
 
298 298
         return false;
Please login to merge, or discard this patch.
src/Handlers/WincacheHandler.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
                 if (wincache_ucache_set(
287 287
                     $this->prefixKey . $session_id,
288 288
                     $session_data,
289
-                    $this->config[ 'lifetime' ]
289
+                    $this->config['lifetime']
290 290
                 )) {
291 291
                     $this->fingerprint = $fingerprint;
292 292
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
                 return false;
297 297
             }
298 298
 
299
-            return wincache_ucache_set($this->prefixKey . $session_id, $session_data, $this->config[ 'lifetime' ]);
299
+            return wincache_ucache_set($this->prefixKey . $session_id, $session_data, $this->config['lifetime']);
300 300
         }
301 301
 
302 302
         return false;
Please login to merge, or discard this patch.
src/Handlers/FileHandler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function open($save_path, $name)
82 82
     {
83
-        $this->path = $this->config[ 'filePath' ];
83
+        $this->path = $this->config['filePath'];
84 84
 
85 85
         if ($this->isSupported() === false) {
86 86
             if ($this->logger instanceof LoggerInterface) {
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
         $this->filePath = $this->path
94 94
             . $name . '-' // we'll use the session cookie name as a prefix to avoid collisions
95
-            . ($this->config[ 'match' ]->ip ? md5($_SERVER[ 'REMOTE_ADDR' ]) . '-' : '');
95
+            . ($this->config['match']->ip ? md5($_SERVER['REMOTE_ADDR']) . '-' : '');
96 96
 
97 97
         return true;
98 98
     }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 
212 212
         while (($file = readdir($directory)) !== false) {
213 213
             // If the filename doesn't match this pattern, it's either not a session file or is not ours
214
-            if ( ! preg_match('/[' . $this->config[ 'name' ] . '-]+[0-9-a-f]+/', $file)
214
+            if ( ! preg_match('/[' . $this->config['name'] . '-]+[0-9-a-f]+/', $file)
215 215
                 || ! is_file($this->path . '/' . $file)
216 216
                 || ($mtime = filemtime($this->path . '/' . $file)) === false
217 217
                 || $mtime > $ts
Please login to merge, or discard this patch.