Completed
Pull Request — devel (#21)
by Philippe
52:25
created
src/services/Oauth.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -85,6 +85,7 @@
 block discarded – undo
85 85
 
86 86
     /**
87 87
      * @param mixed $config
88
+     * @param \yii\base\Module|null $module
88 89
      * @return array Oauth server configuration
89 90
      * @since 1.0.0
90 91
      */
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,38 +44,38 @@
 block discarded – undo
44 44
     public static function register($app)
45 45
     {
46 46
         $module = Module::getInstance();
47
-        Yii::$container->set('OAuth2\Server', function ($container, $params, $config) use ($module) {
47
+        Yii::$container->set('OAuth2\Server', function($container, $params, $config) use ($module) {
48 48
             $storage = Yii::createObject('sweelix\oauth2\server\storage\OauthStorage');
49 49
             $server = new Server($storage, self::prepareServerConfig($config, $module));
50 50
             return $server;
51 51
         });
52 52
 
53
-        Yii::$container->set('OAuth2\GrantType\AuthorizationCode', function ($container, $params, $config) {
53
+        Yii::$container->set('OAuth2\GrantType\AuthorizationCode', function($container, $params, $config) {
54 54
             $storage = Yii::createObject('sweelix\oauth2\server\storage\OauthStorage');
55 55
             $grantType = new AuthorizationCode($storage);
56 56
             return $grantType;
57 57
         });
58 58
 
59
-        Yii::$container->set('OAuth2\GrantType\ClientCredentials', function ($container, $params, $config) use ($module) {
59
+        Yii::$container->set('OAuth2\GrantType\ClientCredentials', function($container, $params, $config) use ($module) {
60 60
             $storage = Yii::createObject('sweelix\oauth2\server\storage\OauthStorage');
61 61
             $grantType = new ClientCredentials($storage, self::prepareServerConfig($config, $module));
62 62
             return $grantType;
63 63
         });
64 64
 
65
-        Yii::$container->set('OAuth2\GrantType\JwtBearer', function ($container, $params, $config) use ($module) {
65
+        Yii::$container->set('OAuth2\GrantType\JwtBearer', function($container, $params, $config) use ($module) {
66 66
             $storage = Yii::createObject('sweelix\oauth2\server\storage\OauthStorage');
67 67
             $audience = Url::to($module->jwtAudience, true);
68 68
             $grantType = new JwtBearer($storage, $audience, null, self::prepareServerConfig($config, $module));
69 69
             return $grantType;
70 70
         });
71 71
 
72
-        Yii::$container->set('OAuth2\GrantType\RefreshToken', function ($container, $params, $config) use ($module) {
72
+        Yii::$container->set('OAuth2\GrantType\RefreshToken', function($container, $params, $config) use ($module) {
73 73
             $storage = Yii::createObject('sweelix\oauth2\server\storage\OauthStorage');
74 74
             $grantType = new RefreshToken($storage, self::prepareServerConfig($config, $module));
75 75
             return $grantType;
76 76
         });
77 77
 
78
-        Yii::$container->set('OAuth2\GrantType\UserCredentials', function ($container, $params, $config) {
78
+        Yii::$container->set('OAuth2\GrantType\UserCredentials', function($container, $params, $config) {
79 79
             $storage = Yii::createObject('sweelix\oauth2\server\storage\OauthStorage');
80 80
             $grantType = new UserCredentials($storage);
81 81
             return $grantType;
Please login to merge, or discard this patch.
src/behaviors/SplitToArrayBehavior.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
      */
57 57
     public function updateAttribute()
58 58
     {
59
-        foreach($this->attributes as $attribute) {
59
+        foreach ($this->attributes as $attribute) {
60 60
             if (empty($this->owner->{$attribute}) === true) {
61 61
                 $this->owner->{$attribute} = [];
62 62
             } elseif (is_array($this->owner->{$attribute}) === false) {
Please login to merge, or discard this patch.
src/controllers/TokenController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@
 block discarded – undo
174 174
         }
175 175
 
176 176
         $headers = $oauthResponse->getHttpHeaders();
177
-        foreach($headers as $name => $value)
177
+        foreach ($headers as $name => $value)
178 178
         {
179 179
             $response->headers->set($name, $value);
180 180
         }
Please login to merge, or discard this patch.
src/views/authorize/authorize.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@
 block discarded – undo
35 35
     <div class="row">
36 36
         <div class="col-md-push-3 col-md-6 col-sm-push-2 col-sm-8 col-xs-12 white-panel">
37 37
             <?php echo Html::beginForm(); ?>
38
-            <?php if(empty($requestedScopes) === false) : ?>
38
+            <?php if (empty($requestedScopes) === false) : ?>
39 39
             <ul class="list-group">
40
-                <?php foreach($requestedScopes as $scope): ?>
40
+                <?php foreach ($requestedScopes as $scope): ?>
41 41
                 <li class="list-group-item">
42 42
                     <h4 class="list-group-item-heading"><?php echo $scope->id; ?></h4>
43 43
                     <p class="list-group-item-text">
Please login to merge, or discard this patch.
src/models/BaseModel.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,6 @@
 block discarded – undo
18 18
 use yii\base\InvalidArgumentException;
19 19
 use yii\base\Model;
20 20
 use yii\base\ModelEvent;
21
-use Yii;
22 21
 use Exception;
23 22
 use yii\base\NotSupportedException;
24 23
 use yii\helpers\Inflector;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         if ($this->hasAttribute($name)) {
172 172
             $this->_attributes[$name] = $value;
173 173
         } else {
174
-            throw new InvalidArgumentException(get_class($this) . ' has no attribute named "' . $name . '".');
174
+            throw new InvalidArgumentException(get_class($this).' has no attribute named "'.$name.'".');
175 175
         }
176 176
     }
177 177
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
         if (isset($this->_oldAttributes[$name]) || $this->hasAttribute($name)) {
209 209
             $this->_oldAttributes[$name] = $value;
210 210
         } else {
211
-            throw new InvalidArgumentException(get_class($this) . ' has no attribute named "' . $name . '".');
211
+            throw new InvalidArgumentException(get_class($this).' has no attribute named "'.$name.'".');
212 212
         }
213 213
     }
214 214
 
@@ -382,10 +382,10 @@  discard block
 block discarded – undo
382 382
      * If not set, [[formName()]] will be used.
383 383
      * @return boolean whether the model is successfully populated with some data.
384 384
      */
385
-    public function loadIds($data, $formName=null)
385
+    public function loadIds($data, $formName = null)
386 386
     {
387 387
         $camelData = [];
388
-        foreach($data as $key => $value) {
388
+        foreach ($data as $key => $value) {
389 389
             $key = lcfirst(Inflector::id2camel($key));
390 390
             $camelData[$key] = $value;
391 391
         }
Please login to merge, or discard this patch.
src/traits/mySql/TypeConverter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         if ((isset($this->attributesDefinitions[$key]) === true)
57 57
             && (in_array($this->attributesDefinitions[$key], $bypassTypes) === false)
58 58
         ) {
59
-            switch($this->attributesDefinitions[$key]) {
59
+            switch ($this->attributesDefinitions[$key]) {
60 60
                 case 'bool':
61 61
                 case 'boolean':
62 62
                     $value = $value ? 1 : 0;
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
             switch ($this->attributesDefinitions[$key]) {
99 99
                 case 'bool':
100 100
                 case 'boolean':
101
-                    $value = (bool) $value;
101
+                    $value = (bool)$value;
102 102
                     break;
103 103
                 case 'int':
104 104
                 case 'integer':
105
-                    $value = (int) $value;
105
+                    $value = (int)$value;
106 106
                     break;
107 107
                 case 'array':
108 108
                     if (is_array($value) === false) {
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
                 case 'real':
120 120
                 case 'double':
121 121
                 case 'float':
122
-                    $value = (float) $value;
122
+                    $value = (float)$value;
123 123
                     break;
124 124
             }
125 125
         }
Please login to merge, or discard this patch.
src/services/mySql/AccessTokenService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             ->where('id = :id', [':id' => $accessTokenKey])
70 70
             ->one($this->db);
71 71
         if ($entity !== false) {
72
-            throw new DuplicateKeyException('Duplicate key "' . $accessTokenKey . '"');
72
+            throw new DuplicateKeyException('Duplicate key "'.$accessTokenKey.'"');
73 73
         }
74 74
         $values = $accessToken->getDirtyAttributes($attributes);
75 75
         $accessTokenParameters = [];
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
                 ->where('id = :id', [':id' => $values[$modelKey]])
136 136
                 ->one($this->db);
137 137
             if ($entity !== false) {
138
-                throw new DuplicateKeyException('Duplicate key "' . $values[$modelKey] . '"');
138
+                throw new DuplicateKeyException('Duplicate key "'.$values[$modelKey].'"');
139 139
             }
140 140
         }
141 141
         $accessTokenKey = isset($values[$modelKey]) ? $values[$modelKey] : $accessToken->getKey();
Please login to merge, or discard this patch.
src/services/mySql/BaseService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
     protected function encodeAttributes(Array $attributes)
79 79
     {
80 80
         $data = Json::encode($attributes);
81
-        $etag = '"' . rtrim(base64_encode(sha1($data, true)), '=') . '"';
81
+        $etag = '"'.rtrim(base64_encode(sha1($data, true)), '=').'"';
82 82
         return $etag;
83 83
     }
84 84
 
Please login to merge, or discard this patch.
src/services/mySql/RefreshTokenService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             ->where('id = :id', [':id' => $refreshTokenKey])
74 74
             ->one($this->db);
75 75
         if ($entity !== false) {
76
-            throw new DuplicateKeyException('Duplicate key "' . $refreshTokenKey . '"');
76
+            throw new DuplicateKeyException('Duplicate key "'.$refreshTokenKey.'"');
77 77
         }
78 78
         $values = $refreshToken->getDirtyAttributes($attributes);
79 79
         $refreshTokenParameters = [];
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                 ->where('id = :id', [':id' => $values[$modelKey]])
140 140
                 ->one($this->db);
141 141
             if ($entity !== false) {
142
-                throw new DuplicateKeyException('Duplicate key "' . $values[$modelKey] . '"');
142
+                throw new DuplicateKeyException('Duplicate key "'.$values[$modelKey].'"');
143 143
             }
144 144
         }
145 145
         $refreshTokenKey = isset($values[$modelKey]) ? $values[$modelKey] : $refreshToken->getKey();
Please login to merge, or discard this patch.