Completed
Branch master (55a5ae)
by Raffael
03:40
created
src/Api/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/Api/Moodle.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      * @param   Iterable $config
91 91
      * @param   Logger   $logger
92 92
      */
93
-    public function __construct(?Iterable $config, Logger $logger)
93
+    public function __construct(? Iterable $config, Logger $logger)
94 94
     {
95 95
         $this->setOptions($config);
96 96
         $this->logger = $logger;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      * @param  Iterable $config
104 104
      * @return Moodle
105 105
      */
106
-    public function setOptions(?Iterable $config): Moodle
106
+    public function setOptions(? Iterable $config) : Moodle
107 107
     {
108 108
         if ($config === null) {
109 109
             return $this;
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
      * @param  string $function
147 147
      * @return array
148 148
      */
149
-    public function restCall(string $params, $function): ?array
149
+    public function restCall(string $params, $function): ? array
150 150
     {
151
-        $url = $this->uri .
152
-            '/webservice/rest/server.php?wstoken=' . $this->token .
153
-            '&wsfunction=' . $function .
154
-            '&moodlewsrestformat=' . $this->moodle_response_format . '&' .
151
+        $url = $this->uri.
152
+            '/webservice/rest/server.php?wstoken='.$this->token.
153
+            '&wsfunction='.$function.
154
+            '&moodlewsrestformat='.$this->moodle_response_format.'&'.
155 155
             $params;
156 156
 
157
-        $this->logger->info('execute curl request [' . $url . ']', [
157
+        $this->logger->info('execute curl request ['.$url.']', [
158 158
             'category' => get_class($this),
159 159
         ]);
160 160
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         $body      = curl_exec($ch);
169 169
         $http_code = curl_getinfo($ch)['http_code'];
170 170
         if ($http_code !== 200) {
171
-            throw new Exception('http request failed with response code ' . $http_code);
171
+            throw new Exception('http request failed with response code '.$http_code);
172 172
         }
173 173
 
174 174
         curl_close($ch);
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
         $body = json_decode($body);
177 177
 
178 178
         if (json_last_error() !== JSON_ERROR_NONE) {
179
-            throw new Exception('failed decode moodle json response with error ' . json_last_error());
179
+            throw new Exception('failed decode moodle json response with error '.json_last_error());
180 180
         } elseif ($body instanceof StdClass && isset($body->exception)) {
181 181
             if (isset($body->debuginfo)) {
182 182
                 $this->logger->debug($body->debuginfo, [
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                 ]);
185 185
             }
186 186
 
187
-            throw new Exception('moodle api request failed with exception ' . $body->message);
187
+            throw new Exception('moodle api request failed with exception '.$body->message);
188 188
         }
189 189
 
190 190
         return $body;
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/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.