Passed
Pull Request — master (#226)
by Christopher
06:35
created
src/Serialisers/SerialiserLowLevelWriters.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
         $kVal     = $typeKind;
69 69
         if (!(ResourceTypeKind::PRIMITIVE() == $kVal || ResourceTypeKind::COMPLEX() == $kVal)) {
70 70
             $msg = '$bagItemResourceTypeKind != ResourceTypeKind::PRIMITIVE'
71
-                   .' && $bagItemResourceTypeKind != ResourceTypeKind::COMPLEX';
71
+                    .' && $bagItemResourceTypeKind != ResourceTypeKind::COMPLEX';
72 72
             throw new InvalidOperationException($msg);
73 73
         }
74 74
         if (null == $result) {
Please login to merge, or discard this patch.
src/Serialisers/IronicSerialiser.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         $targClass = $resourceType->getInstanceType()->getName();
129 129
         if (!($res instanceof $targClass)) {
130 130
             $msg = 'Object being serialised not instance of expected class, '
131
-                   . $targClass . ', is actually ' . $payloadClass;
131
+                    . $targClass . ', is actually ' . $payloadClass;
132 132
             throw new InvalidOperationException($msg);
133 133
         }
134 134
 
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
             if (!(ResourcePropertyKind::RESOURCESET_REFERENCE == $propKind
573 573
                   || ResourcePropertyKind::RESOURCE_REFERENCE == $propKind)) {
574 574
                 $msg = '$propKind != ResourcePropertyKind::RESOURCESET_REFERENCE &&'
575
-                       . ' $propKind != ResourcePropertyKind::RESOURCE_REFERENCE';
575
+                        . ' $propKind != ResourcePropertyKind::RESOURCE_REFERENCE';
576 576
                 throw new InvalidOperationException($msg);
577 577
             }
578 578
             $propTail             = ResourcePropertyKind::RESOURCE_REFERENCE == $propKind ? 'entry' : 'feed';
Please login to merge, or discard this patch.
src/Models/ModelReflectionHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         $fileName = $method->getFileName();
36 36
 
37 37
         $file = new SplFileObject($fileName);
38
-        $file->seek($method->getStartLine() - 1);
38
+        $file->seek($method->getStartLine()-1);
39 39
         $code = '';
40 40
         while ($file->key() < $method->getEndLine()) {
41 41
             $code .= $file->current();
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
         $code  = trim(preg_replace('/\s\s+/', '', $code));
46 46
         $begin = strpos($code, 'function(');
47
-        $code  = substr($code, (int)$begin, strrpos($code, '}') - $begin + 1);
47
+        $code  = substr($code, (int) $begin, strrpos($code, '}')-$begin+1);
48 48
         return $code;
49 49
     }
50 50
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
                 ) {
86 86
                     continue;
87 87
                 }
88
-                $relationships[]= $method;
88
+                $relationships[] = $method;
89 89
             }
90 90
         }
91 91
         return $relationships;
Please login to merge, or discard this patch.
src/Models/ObjectMap/Entities/Associations/AssociationStubPolymorphic.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
             !$thatNull) &&
49 49
             ($this->getBaseType() !== $otherStub->getTargType() ||
50 50
             $otherStub->getBaseType() !== $this->getTargType())
51
-        ){
51
+        ) {
52 52
             return false;
53 53
         }
54 54
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@
 block discarded – undo
44 44
         if ($thisNull == $thatNull && null === $thatTarg) {
45 45
             return false;
46 46
         }
47
-        if((!$thisNull &&
47
+        if ((!$thisNull &&
48 48
             !$thatNull) &&
49 49
             ($this->getBaseType() !== $otherStub->getTargType() ||
50 50
             $otherStub->getBaseType() !== $this->getTargType())
51
-        ){
51
+        ) {
52 52
             return false;
53 53
         }
54 54
 
Please login to merge, or discard this patch.
src/Models/ObjectMap/Entities/Associations/AssociationStubBase.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@
 block discarded – undo
99 99
      */
100 100
     public function getAssocations(): array
101 101
     {
102
-       return array_values($this->associations);
102
+        return array_values($this->associations);
103 103
     }
104 104
 
105 105
     /**
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@
 block discarded – undo
202 202
             }
203 203
         }
204 204
 
205
-        if(null === $this->throughFieldChain){
205
+        if (null === $this->throughFieldChain) {
206 206
             return false;
207 207
         }
208 208
         return (null === $targType) === (null === $foreignField);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@
 block discarded – undo
202 202
             }
203 203
         }
204 204
 
205
-        if(null === $this->throughFieldChain){
205
+        if(null === $this->throughFieldChain) {
206 206
             return false;
207 207
         }
208 208
         return (null === $targType) === (null === $foreignField);
Please login to merge, or discard this patch.
src/Models/ObjectMap/Entities/Associations/AssociationFactory.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
         $entity = $stub->getEntity();
48 48
         $stubs = $entity->getStubs();
49 49
         if(array_key_exists($oldName, $stubs)){
50
-               //unset($stubs[$oldName]);
50
+                //unset($stubs[$oldName]);
51 51
         }
52 52
         $stubs[$stubNew->getRelationName()] = $stubNew;
53 53
         $entity->setStubs($stubs);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
         $first = $oneFirst === $twoFirst ? -1 === $stubOne->compare($stubTwo) : $oneFirst;
23 23
 
24 24
         $association = new AssociationMonomorphic();
25
-        if($stubTwo->getTargType() == null){
25
+        if ($stubTwo->getTargType() == null) {
26 26
             dd($stubTwo);
27 27
         }
28
-        if($stubOne->getTargType() == null && self::$marshalPolymorphics){
28
+        if ($stubOne->getTargType() == null && self::$marshalPolymorphics) {
29 29
             $stubOne = self::marshalPolyToMono($stubOne, $stubTwo);
30 30
         }
31 31
 
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
         //$stubOne->addAssociation($association);
41 41
         $stubNew = clone $stub;
42 42
         $relPolyTypeName = substr($stubTwo->getBaseType(), strrpos($stubTwo->getBaseType(), '\\')+1);
43
-        $relPolyTypeName = Str::plural($relPolyTypeName,  1);
43
+        $relPolyTypeName = Str::plural($relPolyTypeName, 1);
44 44
         $stubNew->setRelationName($stub->getRelationName() . '_' . $relPolyTypeName);
45 45
         $stubNew->setTargType($stubTwo->getBaseType());
46 46
         $stubNew->setForeignFieldName($stubTwo->getKeyFieldName());
47 47
         $entity = $stub->getEntity();
48 48
         $stubs = $entity->getStubs();
49
-        if(array_key_exists($oldName, $stubs)){
49
+        if (array_key_exists($oldName, $stubs)) {
50 50
                //unset($stubs[$oldName]);
51 51
         }
52 52
         $stubs[$stubNew->getRelationName()] = $stubNew;
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 
57 57
     private static function checkAssocations(AssociationStubBase $stubOne, AssociationStubBase $stubTwo): ?Association{
58 58
         $assocOne = $stubOne->getAssocations();
59
-        foreach($assocOne as $association){
59
+        foreach ($assocOne as $association) {
60 60
             $isFirst = $association->getFirst() === $stubOne;
61
-            if($association->{$isFirst ? 'getLast' : 'getFirst'}() == $stubTwo){
61
+            if ($association->{$isFirst ? 'getLast' : 'getFirst'}() == $stubTwo) {
62 62
                 return $association;
63 63
             }
64 64
         }
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
         $first = $oneFirst === $twoFirst ? -1 === $stubOne->compare($stubTwo) : $oneFirst;
23 23
 
24 24
         $association = new AssociationMonomorphic();
25
-        if($stubTwo->getTargType() == null){
25
+        if($stubTwo->getTargType() == null) {
26 26
             dd($stubTwo);
27 27
         }
28
-        if($stubOne->getTargType() == null && self::$marshalPolymorphics){
28
+        if($stubOne->getTargType() == null && self::$marshalPolymorphics) {
29 29
             $stubOne = self::marshalPolyToMono($stubOne, $stubTwo);
30 30
         }
31 31
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         $stubNew->setForeignFieldName($stubTwo->getKeyFieldName());
47 47
         $entity = $stub->getEntity();
48 48
         $stubs = $entity->getStubs();
49
-        if(array_key_exists($oldName, $stubs)){
49
+        if(array_key_exists($oldName, $stubs)) {
50 50
                //unset($stubs[$oldName]);
51 51
         }
52 52
         $stubs[$stubNew->getRelationName()] = $stubNew;
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 
57 57
     private static function checkAssocations(AssociationStubBase $stubOne, AssociationStubBase $stubTwo): ?Association{
58 58
         $assocOne = $stubOne->getAssocations();
59
-        foreach($assocOne as $association){
59
+        foreach($assocOne as $association) {
60 60
             $isFirst = $association->getFirst() === $stubOne;
61
-            if($association->{$isFirst ? 'getLast' : 'getFirst'}() == $stubTwo){
61
+            if($association->{$isFirst ? 'getLast' : 'getFirst'}() == $stubTwo) {
62 62
                 return $association;
63 63
             }
64 64
         }
Please login to merge, or discard this patch.
src/Models/IMetadataRelationshipContainer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      *
15 15
      * @param EntityGubbins $entity
16 16
      */
17
-    public function addEntity(EntityGubbins $entity): void ;
17
+    public function addEntity(EntityGubbins $entity): void;
18 18
 
19 19
     /**
20 20
      * returns all Relation Stubs that are permitted at the other end.
@@ -46,5 +46,5 @@  discard block
 block discarded – undo
46 46
      * @param string $className
47 47
      * @return bool
48 48
      */
49
-    public function hasClass(string $className): bool ;
49
+    public function hasClass(string $className): bool;
50 50
 }
51 51
\ No newline at end of file
Please login to merge, or discard this patch.
src/Models/MetadataRelationshipContainer.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
     private function buildAssocations(): void
53 53
     {
54
-        array_walk_recursive($this->stubs, [$this, 'buildAssocationFromStub'] );
54
+        array_walk_recursive($this->stubs, [$this, 'buildAssocationFromStub']);
55 55
     }
56 56
 
57 57
     /**
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
      */
62 62
     private function getStubs(?string $baseType, ?string $targetType): array
63 63
     {
64
-        if($baseType === null ||
64
+        if ($baseType === null ||
65 65
            !array_key_exists($baseType, $this->stubs) ||
66
-           !array_key_exists($targetType, $this->stubs[$baseType])){
66
+           !array_key_exists($targetType, $this->stubs[$baseType])) {
67 67
             return [];
68 68
         }
69 69
         return $this->stubs[$baseType][$targetType];
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $this->addAssocations($assocations);
87 87
     }
88 88
 
89
-    private function addAssocations(array $additionals){
89
+    private function addAssocations(array $additionals) {
90 90
         $this->assocations = array_merge($this->assocations, $additionals);
91 91
     }
92 92
 
@@ -103,15 +103,15 @@  discard block
 block discarded – undo
103 103
         $this->checkClassExists($className);
104 104
         if (!array_key_exists($relName, $this->entities[$className]->getStubs())) {
105 105
             $msg = 'Relation %s not registered on %s';
106
-            throw new \InvalidArgumentException(sprintf($msg,$relName,$className));
106
+            throw new \InvalidArgumentException(sprintf($msg, $relName, $className));
107 107
         }
108 108
 
109
-        if(empty($this->assocations)) {
109
+        if (empty($this->assocations)) {
110 110
             $this->buildAssocations();
111 111
         }
112 112
         $entites = $this->entities[$className];
113 113
         $relation = $entites->getStubs()[$relName];
114
-        return array_reduce($relation->getAssocations(), function($carry, Association $item) use ($relation){
114
+        return array_reduce($relation->getAssocations(), function ($carry, Association $item) use ($relation){
115 115
             $carry[] = ($item->getFirst() === $relation) ? $item->getLast() : $item->getFirst();
116 116
             return $carry;
117 117
         },[]);
@@ -125,11 +125,11 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function getRelationsByClass(string $className): array
127 127
     {
128
-        if(empty($this->assocations)){
128
+        if (empty($this->assocations)) {
129 129
             $this->buildAssocations();
130 130
         }
131 131
         $this->checkClassExists($className);
132
-        return array_reduce($this->entities[$className]->getStubs(), function($carry, AssociationStubBase $item){
132
+        return array_reduce($this->entities[$className]->getStubs(), function ($carry, AssociationStubBase $item) {
133 133
             return array_merge($carry, $item->getAssocations());
134 134
         },[]);
135 135
     }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     {
142 142
         if (!$this->hasClass($className)) {
143 143
             $msg = '%s does not exist in holder';
144
-            throw new \InvalidArgumentException(sprintf($msg,$className));
144
+            throw new \InvalidArgumentException(sprintf($msg, $className));
145 145
         }
146 146
     }
147 147
     /**
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      */
153 153
     public function getRelations(): array
154 154
     {
155
-        if(empty($this->assocations)) {
155
+        if (empty($this->assocations)) {
156 156
             $this->buildAssocations();
157 157
         }
158 158
         return array_values($this->assocations);
Please login to merge, or discard this patch.
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     {
64 64
         if($baseType === null ||
65 65
            !array_key_exists($baseType, $this->stubs) ||
66
-           !array_key_exists($targetType, $this->stubs[$baseType])){
66
+           !array_key_exists($targetType, $this->stubs[$baseType])) {
67 67
             return [];
68 68
         }
69 69
         return $this->stubs[$baseType][$targetType];
@@ -86,7 +86,8 @@  discard block
 block discarded – undo
86 86
         $this->addAssocations($assocations);
87 87
     }
88 88
 
89
-    private function addAssocations(array $additionals){
89
+    private function addAssocations(array $additionals)
90
+    {
90 91
         $this->assocations = array_merge($this->assocations, $additionals);
91 92
     }
92 93
 
@@ -111,7 +112,7 @@  discard block
 block discarded – undo
111 112
         }
112 113
         $entites = $this->entities[$className];
113 114
         $relation = $entites->getStubs()[$relName];
114
-        return array_reduce($relation->getAssocations(), function($carry, Association $item) use ($relation){
115
+        return array_reduce($relation->getAssocations(), function($carry, Association $item) use ($relation) {
115 116
             $carry[] = ($item->getFirst() === $relation) ? $item->getLast() : $item->getFirst();
116 117
             return $carry;
117 118
         },[]);
@@ -125,11 +126,11 @@  discard block
 block discarded – undo
125 126
      */
126 127
     public function getRelationsByClass(string $className): array
127 128
     {
128
-        if(empty($this->assocations)){
129
+        if(empty($this->assocations)) {
129 130
             $this->buildAssocations();
130 131
         }
131 132
         $this->checkClassExists($className);
132
-        return array_reduce($this->entities[$className]->getStubs(), function($carry, AssociationStubBase $item){
133
+        return array_reduce($this->entities[$className]->getStubs(), function($carry, AssociationStubBase $item) {
133 134
             return array_merge($carry, $item->getAssocations());
134 135
         },[]);
135 136
     }
Please login to merge, or discard this patch.
src/Models/ObjectMap/Entities/Associations/AssociationStubFactory.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
         $stub->setRelationName($name);
146 146
         $stub->setThroughFieldChain($keyChain);
147 147
         $stub->setKeyFieldName($keyChain[0]);
148
-        $stub->setForeignFieldName( $keyChain[4]);
148
+        $stub->setForeignFieldName($keyChain[4]);
149 149
         $stub->setMultiplicity(AssociationStubRelationType::MANY());
150 150
         $stub->setMorphType($keyChain[2]);
151
-        $stub->setTargType( get_class($relation->getRelated()));
151
+        $stub->setTargType(get_class($relation->getRelated()));
152 152
         return $stub;
153 153
     }
154 154
 
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 
258 258
     private static $fieldOrderCache = [
259 259
         'BelongsTo' => ['foreignKey', 'ownerKey'],
260
-        'BelongsToMany' => ['parentKey','foreignPivotKey','relatedPivotKey','relatedKey'],
261
-        'HasOneOrMany' => ['localKey', 'foreignKey' ],
260
+        'BelongsToMany' => ['parentKey', 'foreignPivotKey', 'relatedPivotKey', 'relatedKey'],
261
+        'HasOneOrMany' => ['localKey', 'foreignKey'],
262 262
         'HasManyThrough' => ['localKey', 'firstKey', 'secondLocalKey', 'secondKey'],
263
-        'MorphToMany' => ['parentKey','foreignPivotKey','morphType', 'relatedPivotKey','relatedKey'],
263
+        'MorphToMany' => ['parentKey', 'foreignPivotKey', 'morphType', 'relatedPivotKey', 'relatedKey'],
264 264
         'MorphTo' => ['foreignKey', 'morphType', 'ownerKey'],
265 265
         'MorphOneOrMany' => ['localKey', 'morphType', 'foreignKey'],
266 266
     ];
Please login to merge, or discard this patch.