Completed
Branch master (55a5ae)
by Raffael
03:40
created
src/Log.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Micro
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @param   Iterable $config
57 57
      * @return  void
58 58
      */
59
-    public function __construct(?Iterable $config=null)
59
+    public function __construct(? Iterable $config = null)
60 60
     {
61 61
         $this->setOptions($config);
62 62
     }
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
      * @param  Iterable $config
69 69
      * @return Logger
70 70
      */
71
-    public function setOptions(?Iterable $config=null)
71
+    public function setOptions(? Iterable $config = null)
72 72
     {
73
-        if($config === null) {
73
+        if ($config === null) {
74 74
             return $this;
75 75
         }
76 76
 
77
-        foreach($config as $option => $value) {
78
-            if(!isset($value['enabled']) || $value['enabled'] === '1') {
77
+        foreach ($config as $option => $value) {
78
+            if (!isset($value['enabled']) || $value['enabled'] === '1') {
79 79
                 $this->addAdapter($option, $value['class'], $value['config']);
80 80
             }
81 81
         }
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
      * @param  Iterable $config
93 93
      * @return AdapterInterface
94 94
      */
95
-    public function addAdapter(string $name, string $class, ?Iterable $config=null): AdapterInterface
95
+    public function addAdapter(string $name, string $class, ? Iterable $config = null) : AdapterInterface
96 96
     {
97
-        if(isset($this->adapter[$name])) {
97
+        if (isset($this->adapter[$name])) {
98 98
             throw new Exception\InvalidArgument('log adapter '.$name.' is already registered');
99 99
         }
100 100
             
101 101
         $adapter = new $class($config);
102
-        if(!($adapter instanceof AdapterInterface)) {
102
+        if (!($adapter instanceof AdapterInterface)) {
103 103
             throw new Exception\InvalidArgument('log adapter must include AdapterInterface interface');
104 104
         }
105 105
         $this->adapter[$name] = $adapter;
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      */
116 116
     public function getAdapter(string $name): AdapterInterface
117 117
     {
118
-        if(!isset($this->adapter[$name])) {
118
+        if (!isset($this->adapter[$name])) {
119 119
             throw new Exception('log adapter '.$name.' is not registered');
120 120
         }
121 121
 
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
      * @param  array $adapters
130 130
      * @return array
131 131
      */
132
-    public function getAdapters(array $adapters=[]): array
132
+    public function getAdapters(array $adapters = []): array
133 133
     {
134
-        if(empty($adapter)) {
134
+        if (empty($adapter)) {
135 135
             return $this->adapter;
136 136
         } else {
137 137
             $list = [];
138
-            foreach($adapter as $name) {
139
-                if(!isset($this->adapter[$name])) {
138
+            foreach ($adapter as $name) {
139
+                if (!isset($this->adapter[$name])) {
140 140
                     throw new Exception('log adapter '.$name.' is not registered');
141 141
                 }
142 142
                 $list[$name] = $this->adapter[$name];
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      * @param   array $context
157 157
      * @return  bool
158 158
      */
159
-    public function log($level, $message, array $context=[]): bool
159
+    public function log($level, $message, array $context = []): bool
160 160
     {
161 161
         if (!array_key_exists($level, self::PRIORITIES)) {
162 162
             throw new Exception\InvalidArgument('log level '.$level.' is unkown');
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
      * @param   array $context
200 200
      * @return  void
201 201
      */
202
-    protected function _format(string $message, string $format, string $date_format, string $level, array $context=[]): string
202
+    protected function _format(string $message, string $format, string $date_format, string $level, array $context = []): string
203 203
     {
204
-        $parsed = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function ($match) use ($message, $level, $date_format, $context) {
204
+        $parsed = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function($match) use ($message, $level, $date_format, $context) {
205 205
             $key = '';
206 206
             $context = array_merge($this->context, $context);
207 207
                     
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
                     $replace = [];
225 225
                     foreach ($context as $key => $val) {
226 226
                         if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) {
227
-                            $replace['{' . $key . '}'] = $val;
227
+                            $replace['{'.$key.'}'] = $val;
228 228
                         } else {
229
-                            $replace['{' . $key . '}'] = json_encode($val);
229
+                            $replace['{'.$key.'}'] = json_encode($val);
230 230
                         }
231 231
                     }
232 232
 
Please login to merge, or discard this patch.
src/Ldap.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Micro
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      *
69 69
      * @var bool
70 70
      */
71
-    protected $tls=false;
71
+    protected $tls = false;
72 72
 
73 73
 
74 74
     /**
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      * @param   Logger $logger
87 87
      * @return  resource
88 88
      */
89
-    public function __construct(?Iterable $config, Logger $logger)
89
+    public function __construct(? Iterable $config, Logger $logger)
90 90
     {
91 91
         $this->setOptions($config);
92 92
         $this->logger = $logger;
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
      */
101 101
     public function connect(): Ldap
102 102
     {
103
-        if($this->binddn === null) {
103
+        if ($this->binddn === null) {
104 104
             $this->logger->warning('no binddn set for ldap connection, you should avoid anonymous bind', [
105 105
                 'category' => get_class($this),
106 106
             ]);
107 107
         }
108 108
         
109
-        if($this->tls === false || substr($this->uri, 0, 5) !== 'ldaps') {
109
+        if ($this->tls === false || substr($this->uri, 0, 5) !== 'ldaps') {
110 110
             $this->logger->warning('neither tls nor ldaps enabled for ldap connection, it is strongly reccommended to encrypt ldap connections', [
111 111
                 'category' => get_class($this),
112 112
             ]);
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         }
124 124
 
125 125
         if ($this->connection) {
126
-            if($this->binddn !== null) {
126
+            if ($this->binddn !== null) {
127 127
                 $bind = ldap_bind($this->connection, $this->binddn, $this->bindpw);
128 128
 
129 129
                 if ($bind) {
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      * @param  Iterable $config
166 166
      * @return Ldap
167 167
      */
168
-    public function setOptions(?Iterable $config=null): Ldap
168
+    public function setOptions(? Iterable $config = null) : Ldap
169 169
     {
170 170
         if ($config === null) {
171 171
             return $this;
Please login to merge, or discard this patch.
src/Logger.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Micro
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      * @param   Iterable $config
56 56
      * @return  void
57 57
      */
58
-    public function __construct(?Iterable $config=null)
58
+    public function __construct(? Iterable $config = null)
59 59
     {
60 60
         $this->setOptions($config);
61 61
     }
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
      * @param  Iterable $config
68 68
      * @return Logger
69 69
      */
70
-    public function setOptions(?Iterable $config=null)
70
+    public function setOptions(? Iterable $config = null)
71 71
     {
72
-        if($config === null) {
72
+        if ($config === null) {
73 73
             return $this;
74 74
         }
75 75
 
76
-        foreach($config as $option => $value) {
77
-            if(isset($value['enabled']) && $value['enabled'] === '1') {
76
+        foreach ($config as $option => $value) {
77
+            if (isset($value['enabled']) && $value['enabled'] === '1') {
78 78
                 $this->addAdapter($option, $value['class'], $value['config']);
79 79
             }
80 80
         }
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
      * @param  Iterable $config
92 92
      * @return AdapterInterface
93 93
      */
94
-    public function addAdapter(string $name, string $class, ?Iterable $config=null): AdapterInterface
94
+    public function addAdapter(string $name, string $class, ? Iterable $config = null) : AdapterInterface
95 95
     {
96
-        if(isset($this->adapter[$name])) {
96
+        if (isset($this->adapter[$name])) {
97 97
             throw new Exception\InvalidArgument('log adapter '.$name.' is already registered');
98 98
         }
99 99
             
100 100
         $adapter = new $class($config);
101
-        if(!($adapter instanceof AdapterInterface)) {
101
+        if (!($adapter instanceof AdapterInterface)) {
102 102
             throw new Exception\InvalidArgument('log adapter must include AdapterInterface interface');
103 103
         }
104 104
         $this->adapter[$name] = $adapter;
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      */
115 115
     public function getAdapter(string $name): AdapterInterface
116 116
     {
117
-        if(!isset($this->adapter[$name])) {
117
+        if (!isset($this->adapter[$name])) {
118 118
             throw new Exception('log adapter '.$name.' is not registered');
119 119
         }
120 120
 
@@ -128,14 +128,14 @@  discard block
 block discarded – undo
128 128
      * @param  array $adapters
129 129
      * @return array
130 130
      */
131
-    public function getAdapters(array $adapters=[]): array
131
+    public function getAdapters(array $adapters = []): array
132 132
     {
133
-        if(empty($adapter)) {
133
+        if (empty($adapter)) {
134 134
             return $this->adapter;
135 135
         } else {
136 136
             $list = [];
137
-            foreach($adapter as $name) {
138
-                if(!isset($this->adapter[$name])) {
137
+            foreach ($adapter as $name) {
138
+                if (!isset($this->adapter[$name])) {
139 139
                     throw new Exception('log adapter '.$name.' is not registered');
140 140
                 }
141 141
                 $list[$name] = $this->adapter[$name];
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      * @param   array $context
156 156
      * @return  bool
157 157
      */
158
-    public function log($level, $message, array $context=[]): bool
158
+    public function log($level, $message, array $context = []): bool
159 159
     {
160 160
         if (!array_key_exists($level, self::PRIORITIES)) {
161 161
             throw new Exception\InvalidArgument('log level '.$level.' is unkown');
@@ -198,9 +198,9 @@  discard block
 block discarded – undo
198 198
      * @param   array $context
199 199
      * @return  void
200 200
      */
201
-    protected function _format(string $message, string $format, string $date_format, string $level, array $context=[]): string
201
+    protected function _format(string $message, string $format, string $date_format, string $level, array $context = []): string
202 202
     {
203
-        $parsed = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function ($match) use ($message, $level, $date_format, $context) {
203
+        $parsed = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function($match) use ($message, $level, $date_format, $context) {
204 204
             $key = '';
205 205
             $context = array_merge($this->context, $context);
206 206
                     
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
                     $replace = [];
224 224
                     foreach ($context as $key => $val) {
225 225
                         if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) {
226
-                            $replace['{' . $key . '}'] = $val;
226
+                            $replace['{'.$key.'}'] = $val;
227 227
                         } else {
228
-                            $replace['{' . $key . '}'] = json_encode($val);
228
+                            $replace['{'.$key.'}'] = json_encode($val);
229 229
                         }
230 230
                     }
231 231
 
Please login to merge, or discard this patch.
src/Http.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Micro
Please login to merge, or discard this patch.
src/Ldap/Exception.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Micro
Please login to merge, or discard this patch.
src/Config.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Micro
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      * @param   string $config
41 41
      * @return  void
42 42
      */
43
-    public function __construct($config=[])
43
+    public function __construct($config = [])
44 44
     {
45 45
         if ($config instanceof ConfigInterface) {
46 46
             $this->store = $config->map();
Please login to merge, or discard this patch.