Completed
Branch master (93c41b)
by Neomerx
05:29
created
src/Contracts/Adapters/FilterOperationsInterface.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@
 block discarded – undo
1 1
 <?php namespace Limoncello\Flute\Contracts\Adapters;
2 2
 
3 3
     /**
4
- * Copyright 2015-2017 [email protected]
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
4
+     * Copyright 2015-2017 [email protected]
5
+     *
6
+     * Licensed under the Apache License, Version 2.0 (the "License");
7
+     * you may not use this file except in compliance with the License.
8
+     * You may obtain a copy of the License at
9
+     *
10
+     * http://www.apache.org/licenses/LICENSE-2.0
11
+     *
12
+     * Unless required by applicable law or agreed to in writing, software
13
+     * distributed under the License is distributed on an "AS IS" BASIS,
14
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+     * See the License for the specific language governing permissions and
16
+     * limitations under the License.
17
+     */
18 18
 use Doctrine\DBAL\Query\Expression\CompositeExpression;
19 19
 use Doctrine\DBAL\Query\QueryBuilder;
20 20
 use Neomerx\JsonApi\Exceptions\ErrorCollection;
Please login to merge, or discard this patch.
src/Api/Crud.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
         $saveMain = $this->getRepository()->create($modelClass, $allowedChanges);
324 324
         $saveMain = $this->builderSaveResourceOnCreate($saveMain);
325 325
         $saveMain->getSQL(); // prepare
326
-        $this->inTransaction(function () use ($modelClass, $saveMain, $toMany, &$index) {
326
+        $this->inTransaction(function() use ($modelClass, $saveMain, $toMany, &$index) {
327 327
             $saveMain->execute();
328 328
             // if no index given will use last insert ID as index
329 329
             $index !== null ?: $index = $saveMain->getConnection()->lastInsertId();
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
         $saveMain = $this->getRepository()->update($modelClass, $index, $allowedChanges);
357 357
         $saveMain = $this->builderSaveResourceOnUpdate($saveMain);
358 358
         $saveMain->getSQL(); // prepare
359
-        $this->inTransaction(function () use ($modelClass, $saveMain, $toMany, $index, &$updated) {
359
+        $this->inTransaction(function() use ($modelClass, $saveMain, $toMany, $index, &$updated) {
360 360
             $updated = $saveMain->execute();
361 361
             foreach ($toMany as $name => $values) {
362 362
                 $indexBind      = ':index';
Please login to merge, or discard this patch.
src/Http/BaseController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $queryParser    = $container->get(QueryParametersParserInterface::class);
105 105
         $encodingParams = $queryParser->parse($request);
106 106
 
107
-        list ($filters, , $includes) = static::mapQueryParameters($container, $encodingParams, static::SCHEMA_CLASS);
107
+        list ($filters,, $includes) = static::mapQueryParameters($container, $encodingParams, static::SCHEMA_CLASS);
108 108
 
109 109
         $index     = $routeParams[static::ROUTE_KEY_INDEX];
110 110
         $modelData = self::createApi($container)->read($index, $filters, $includes);
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
         /** @var JsonSchemesInterface $jsonSchemes */
378 378
         $jsonSchemes  = $container->get(JsonSchemesInterface::class);
379 379
         $targetSchema = $jsonSchemes->getRelationshipSchema(static::SCHEMA_CLASS, $relationshipName);
380
-        list ($filters, $sorts, , $paging) =
380
+        list ($filters, $sorts,, $paging) =
381 381
             static::mapQueryParameters($container, $encodingParams, get_class($targetSchema));
382 382
 
383 383
         /** @var SchemaInterface $schemaClass */
Please login to merge, or discard this patch.
src/Http/QueryTransformer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -235,7 +235,7 @@
 block discarded – undo
235 235
             $mappedParam = $this->createFilterAttributeParameter($jsonName, $column, $value);
236 236
         } elseif ($this->canMapRelationship($jsonName) === true) {
237 237
             $modelName   = $this->getRelationshipMappings()[$jsonName];
238
-            $type        =  $this->getModelSchemes()->getRelationshipType($this->getCurrentModelClass(), $modelName);
238
+            $type        = $this->getModelSchemes()->getRelationshipType($this->getCurrentModelClass(), $modelName);
239 239
             $mappedParam = $this->createFilterRelationshipParameter($jsonName, $modelName, $value, $type);
240 240
         } else {
241 241
             // filters could actually be applied to attributes in relationships
Please login to merge, or discard this patch.
src/Http/Traits/FluteRoutesTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
         $subUri = $type = $schemeClass::TYPE;
50 50
 
51 51
         $indexSlug = '/{' . BaseController::ROUTE_KEY_INDEX . '}';
52
-        $params    = function ($method) use ($type) {
52
+        $params    = function($method) use ($type) {
53 53
             return [RouteInterface::PARAM_NAME => $type . '_' . $method];
54 54
         };
55
-        $handler   = function ($method) use ($controllerClass) {
55
+        $handler   = function($method) use ($controllerClass) {
56 56
             return [$controllerClass, $method];
57 57
         };
58 58
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
         /** @var SchemaInterface $schemaClass */
86 86
         assert(array_key_exists(SchemaInterface::class, class_implements($schemaClass)) === true);
87
-        $subUri      = $schemaClass::TYPE;
87
+        $subUri = $schemaClass::TYPE;
88 88
 
89 89
         /** @var string $controllerClass */
90 90
         /** @var string $schemaClass */
Please login to merge, or discard this patch.
src/Adapters/Repository.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
         $table = $this->getTableName($modelClass);
288 288
         foreach ($sortParams as $sortParam) {
289 289
             /** @var SortParameterInterface $sortParam */
290
-            $column    = null;
290
+            $column = null;
291 291
             if ($sortParam->isRelationship() === false) {
292 292
                 $column = $sortParam->getName();
293 293
             } elseif ($sortParam->getRelationshipType() === RelationshipTypes::BELONGS_TO) {
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
                     switch ($filterParam->getRelationshipType()) {
358 358
                         case RelationshipTypes::BELONGS_TO:
359 359
                             if ($filterParam->isForAttributeInRelationship() === true) {
360
-                                $foreignKey   = $modelSchemes->getForeignKey(
360
+                                $foreignKey = $modelSchemes->getForeignKey(
361 361
                                     $modelClass,
362 362
                                     $filterParam->getRelationshipName()
363 363
                                 );
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
                             break;
415 415
                         case RelationshipTypes::BELONGS_TO_MANY:
416 416
                             // here we join intermediate belongsToMany table and apply filter on its 2nd foreign key
417
-                            list ($intermediateTable, $intermediatePk , $intermediateFk) = $modelSchemes
417
+                            list ($intermediateTable, $intermediatePk, $intermediateFk) = $modelSchemes
418 418
                                 ->getBelongsToManyRelationship($modelClass, $filterParam->getRelationshipName());
419 419
                             $primaryKey    = $modelSchemes->getPrimaryKey($modelClass);
420 420
                             $aliased       = $intermediateTable . $this->getNewAliasId();
Please login to merge, or discard this patch.
src/Adapters/FilterOperations.php 1 patch
Spacing   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -181,8 +181,7 @@  discard block
 block discarded – undo
181 181
         foreach ($values as $value) {
182 182
             $placeholders[] = $builder->createNamedParameter((string)$value);
183 183
         }
184
-        $placeholders === null ?:
185
-            $link->add($builder->expr()->in($this->getTableColumn($table, $column), $placeholders));
184
+        $placeholders === null ?: $link->add($builder->expr()->in($this->getTableColumn($table, $column), $placeholders));
186 185
     }
187 186
 
188 187
     /**
@@ -205,8 +204,7 @@  discard block
 block discarded – undo
205 204
         foreach ($values as $value) {
206 205
             $placeholders[] = $builder->createNamedParameter((string)$value);
207 206
         }
208
-        $placeholders === null ?:
209
-            $link->add($builder->expr()->notIn($this->getTableColumn($table, $column), $placeholders));
207
+        $placeholders === null ?: $link->add($builder->expr()->notIn($this->getTableColumn($table, $column), $placeholders));
210 208
     }
211 209
 
212 210
     /**
Please login to merge, or discard this patch.