Passed
Push — master ( f3e8e2...c3e813 )
by Andre
13:33 queued 10:38
created
src/elements/Provider.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function getFieldContext(): string
95 95
     {
96
-        return 'enupalSocializer:' . $this->id;
96
+        return 'enupalSocializer:'.$this->id;
97 97
     }
98 98
 
99 99
     /**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public static function displayName(): string
105 105
     {
106
-        return Craft::t('enupal-socializer','Socializer');
106
+        return Craft::t('enupal-socializer', 'Socializer');
107 107
     }
108 108
 
109 109
     /**
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
     public function getCpEditUrl(): ?string
164 164
     {
165 165
         return UrlHelper::cpUrl(
166
-            'enupal-socializer/providers/edit/' . $this->id
166
+            'enupal-socializer/providers/edit/'.$this->id
167 167
         );
168 168
     }
169 169
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         $sources = [
196 196
             [
197 197
                 'key' => '*',
198
-                'label' => Craft::t('enupal-socializer','All Providers'),
198
+                'label' => Craft::t('enupal-socializer', 'All Providers'),
199 199
             ]
200 200
         ];
201 201
 
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
     protected static function defineSortOptions(): array
239 239
     {
240 240
         $attributes = [
241
-            'elements.dateCreated' => Craft::t('enupal-socializer','Date Created'),
242
-            'name' => Craft::t('enupal-socializer','Name')
241
+            'elements.dateCreated' => Craft::t('enupal-socializer', 'Date Created'),
242
+            'name' => Craft::t('enupal-socializer', 'Name')
243 243
         ];
244 244
 
245 245
         return $attributes;
@@ -251,9 +251,9 @@  discard block
 block discarded – undo
251 251
     protected static function defineTableAttributes(): array
252 252
     {
253 253
         $attributes = [];
254
-        $attributes['name'] = ['label' => Craft::t('enupal-socializer','Name')];
255
-        $attributes['handle'] = ['label' => Craft::t('enupal-socializer','Handle')];
256
-        $attributes['dateCreated'] = ['label' => Craft::t('enupal-socializer','Date Created')];
254
+        $attributes['name'] = ['label' => Craft::t('enupal-socializer', 'Name')];
255
+        $attributes['handle'] = ['label' => Craft::t('enupal-socializer', 'Handle')];
256
+        $attributes['dateCreated'] = ['label' => Craft::t('enupal-socializer', 'Date Created')];
257 257
 
258 258
         return $attributes;
259 259
     }
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
      */
264 264
     protected static function defineDefaultTableAttributes(string $source): array
265 265
     {
266
-        $attributes = ['name', 'handle' , 'dateCreated'];
266
+        $attributes = ['name', 'handle', 'dateCreated'];
267 267
 
268 268
         return $attributes;
269 269
     }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
             $record = ProviderRecord::findOne($this->id);
309 309
 
310 310
             if (!$record) {
311
-                throw new \Exception('Invalid Provider ID: ' . $this->id);
311
+                throw new \Exception('Invalid Provider ID: '.$this->id);
312 312
             }
313 313
         } else {
314 314
             $record->id = $this->id;
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
         $record->clientSecret = $this->clientSecret;
323 323
         $record->fieldMapping = $this->fieldMapping;
324 324
 
325
-        if (is_array($record->fieldMapping)){
325
+        if (is_array($record->fieldMapping)) {
326 326
             $record->fieldMapping = json_encode($record->fieldMapping);
327 327
         };
328 328
 
Please login to merge, or discard this patch.
src/controllers/ProvidersController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
         // Save it
48 48
         if (!Socializer::$app->providers->saveProvider($provider)) {
49
-            Craft::$app->getSession()->setError(Craft::t('enupal-socializer','Couldn’t save provider'));
49
+            Craft::$app->getSession()->setError(Craft::t('enupal-socializer', 'Couldn’t save provider'));
50 50
 
51 51
             Craft::$app->getUrlManager()->setRouteParams([
52 52
                     'provider' => $provider
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             return null;
57 57
         }
58 58
 
59
-        Craft::$app->getSession()->setNotice(Craft::t('enupal-socializer','Provider saved.'));
59
+        Craft::$app->getSession()->setNotice(Craft::t('enupal-socializer', 'Provider saved.'));
60 60
 
61 61
         return $this->redirectToPostedUrl($provider);
62 62
     }
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
             $request = Craft::$app->getRequest();
80 80
             $providerType = $request->getRequiredBodyParam("providerType");
81 81
             $provider = Socializer::$app->providers->getProviderByType($providerType);
82
-            if ($provider){
83
-                throw new \Exception(Craft::t('enupal-socializer','Provider '.$provider->name.' already exists'));
82
+            if ($provider) {
83
+                throw new \Exception(Craft::t('enupal-socializer', 'Provider '.$provider->name.' already exists'));
84 84
             }
85 85
             $providerName = Socializer::$app->providers->getClassNameFromNamespace($providerType);
86 86
             $providerHandle = lcfirst($providerName);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
                 return $this->redirect($url);
92 92
             } else {
93 93
                 $errors = $provider->getErrors();
94
-                throw new \Exception(Craft::t('enupal-socializer','Error creating the Provider'.json_encode($errors)));
94
+                throw new \Exception(Craft::t('enupal-socializer', 'Error creating the Provider'.json_encode($errors)));
95 95
             }
96 96
         } else {
97 97
             if ($providerId !== null) {
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
                     $provider = Socializer::$app->providers->getProviderById($providerId);
101 101
 
102 102
                     if (!$provider) {
103
-                        throw new NotFoundHttpException(Craft::t('enupal-socializer','Provider not found'));
103
+                        throw new NotFoundHttpException(Craft::t('enupal-socializer', 'Provider not found'));
104 104
                     }
105 105
                 }
106 106
             }
107 107
         }
108 108
 
109
-        if (is_string($provider->fieldMapping)){
109
+        if (is_string($provider->fieldMapping)) {
110 110
             $provider->fieldMapping = json_decode($provider->fieldMapping, true);
111 111
         }
112 112
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         // @TODO - handle errors
149 149
         Socializer::$app->providers->deleteProvider($provider);
150 150
 
151
-        Craft::$app->getSession()->setNotice(Craft::t('enupal-socializer','Provider deleted.'));
151
+        Craft::$app->getSession()->setNotice(Craft::t('enupal-socializer', 'Provider deleted.'));
152 152
 
153 153
         return $this->redirectToPostedUrl($provider);
154 154
     }
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
             $reflection = new \ReflectionClass($providerType);
173 173
             $property = $reflection->getProperty('apiDocumentation');
174 174
             $property->setAccessible(true);
175
-            $obj = new $providerType(['callback' => 'https://example.com/path/to/script.php',"keys"=>["key" => "ads", "secret"=>"test"]]);
175
+            $obj = new $providerType(['callback' => 'https://example.com/path/to/script.php', "keys"=>["key" => "ads", "secret"=>"test"]]);
176 176
 
177 177
             return $property->getValue($obj);
178 178
         } catch (\Exception $e) {
179
-            Craft::error("Error trying to get api documentation: ".$e->getMessage() , __METHOD__);
179
+            Craft::error("Error trying to get api documentation: ".$e->getMessage(), __METHOD__);
180 180
         }
181 181
 
182 182
         return "No Docs available for {$providerType}";
Please login to merge, or discard this patch.