GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( dc130e...3adfb7 )
by Axel
02:46
created
src/Cache/Pool/MemoryCacheItemPool.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
      * {@inheritdoc}
17 17
      */
18 18
     public function deleteItem($key) {
19
-        if(isset($this->items[$key])) {
19
+        if (isset($this->items[$key])) {
20 20
             unset($this->items[$key]);
21 21
         }
22
-        if(isset($this->deferredItems[$key])) {
22
+        if (isset($this->deferredItems[$key])) {
23 23
             unset($this->deferredItems[$key]);
24 24
         }
25 25
         return true;
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
      * {@inheritdoc}
30 30
      */
31 31
     public function deleteItems(array $keys) {
32
-        foreach($keys as $key) {
33
-            if(!$this->deleteItem($key)) {
32
+        foreach ($keys as $key) {
33
+            if (!$this->deleteItem($key)) {
34 34
                 return false;
35 35
             }
36 36
         }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      * {@inheritdoc}
60 60
      */
61 61
     public function commit() {
62
-        foreach($this->deferredItems as $key => $item) {
62
+        foreach ($this->deferredItems as $key => $item) {
63 63
             $this->items[$key] = $item;
64 64
             unset($this->deferredItems[$key]);
65 65
         }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * {@inheritdoc}
78 78
      */
79 79
     public function getItem($key) {
80
-        if(!$this->hasItem($key)) {
80
+        if (!$this->hasItem($key)) {
81 81
             return new MemoryCacheItem($key);
82 82
         }
83 83
         return $this->items[$key];
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public function getItems(array $keys = array()) {
90 90
         $items = [];
91
-        foreach($keys as $key) {
92
-            if($this->hasItem($key)) {
91
+        foreach ($keys as $key) {
92
+            if ($this->hasItem($key)) {
93 93
                 $items[$key] = $this->getItem($key);
94 94
             }
95 95
         }
Please login to merge, or discard this patch.
src/Cache/Item/MemoryCacheItem.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
      * {@inheritdoc}
54 54
      */
55 55
     public function get() {
56
-        if(!$this->isHit()) {
56
+        if (!$this->isHit()) {
57 57
             throw new ExpiredCacheException('Cache item is expired');
58 58
         }
59 59
         return $this->value;
Please login to merge, or discard this patch.
src/Manager/CacheManager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         $item = $pool->getItem($key);
31 31
         
32 32
         // In this case, the pool returned a new CacheItem
33
-        if($item->get() === null) {
33
+        if ($item->get() === null) {
34 34
             $item->expiresAfter($ttl);
35 35
         }
36 36
         return $item;
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
      * @return Psr\Cache\CacheItemPoolInterface
43 43
      */
44 44
     public function getItemPool($driver) {
45
-        if(!isset($this->pools[$driver])) {
46
-            $poolClass = 'PhpAbac\\Cache\\Pool\\' . ucfirst($driver) . 'CacheItemPool';
45
+        if (!isset($this->pools[$driver])) {
46
+            $poolClass = 'PhpAbac\\Cache\\Pool\\'.ucfirst($driver).'CacheItemPool';
47 47
             $this->pools[$driver] = new $poolClass();
48 48
         }
49 49
         return $this->pools[$driver];
Please login to merge, or discard this patch.
src/Manager/AttributeManager.php 2 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,6 @@  discard block
 block discarded – undo
69 69
 
70 70
     /**
71 71
      * @param AbstractAttribute $attribute
72
-     * @param string $attributeType
73 72
      * @param object $user
74 73
      * @param object $object
75 74
      * @return mixed
@@ -108,7 +107,7 @@  discard block
 block discarded – undo
108 107
     /**
109 108
      * 
110 109
      * @param \PhpAbac\Model\EnvironmentAttribute $attribute
111
-     * @return mixed
110
+     * @return string
112 111
      */
113 112
     private function retrieveEnvironmentAttribute(EnvironmentAttribute $attribute) {
114 113
         return getenv($attribute->getVariableName());
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function retrieveAttribute(AbstractAttribute $attribute, $user, $object = null)
78 78
     {
79
-        switch($attribute->getType()) {
79
+        switch ($attribute->getType()) {
80 80
             case 'user':
81 81
                 return $this->retrieveClassicAttribute($attribute, $user);
82 82
             case 'resource':
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
     {
96 96
         $propertyPath = explode('.', $attribute->getProperty());
97 97
         $propertyValue = $object;
98
-        foreach($propertyPath as $property) {
98
+        foreach ($propertyPath as $property) {
99 99
             $getter = 'get'.ucfirst($property);
100
-            if(!method_exists($propertyValue, $getter)) {
100
+            if (!method_exists($propertyValue, $getter)) {
101 101
                 throw new \InvalidArgumentException('There is no getter for the "'.$attribute->getProperty().'" attribute for object "'.get_class($propertyValue).'"');
102 102
             }
103 103
             $propertyValue = $propertyValue->{$getter}();
Please login to merge, or discard this patch.
src/Manager/ConfigurationManager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,12 +34,12 @@
 block discarded – undo
34 34
      * @param array $configurationFiles
35 35
      */
36 36
     public function parseConfigurationFile($configurationFiles) {
37
-        foreach($configurationFiles as $configurationFile) {
37
+        foreach ($configurationFiles as $configurationFile) {
38 38
             $config = $this->loaders[$this->format]->load($configurationFile);
39
-            if(isset($config['attributes'])) {
39
+            if (isset($config['attributes'])) {
40 40
                 $this->attributes = array_merge($this->attributes, $config['attributes']);
41 41
             }
42
-            if(isset($config['rules'])) {
42
+            if (isset($config['rules'])) {
43 43
                 $this->rules = array_merge($this->rules, $config['rules']);
44 44
             }
45 45
         }
Please login to merge, or discard this patch.
src/Abac.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -7,9 +7,7 @@
 block discarded – undo
7 7
 use PhpAbac\Manager\ConfigurationManager;
8 8
 use PhpAbac\Manager\CacheManager;
9 9
 use PhpAbac\Manager\ComparisonManager;
10
-
11 10
 use Symfony\Component\Config\FileLocator;
12
-
13 11
 use PhpAbac\Model\PolicyRuleAttribute;
14 12
 
15 13
 class Abac
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -70,18 +70,18 @@  discard block
 block discarded – undo
70 70
     public function enforce($ruleName, $user, $resource = null, $options = []) {
71 71
         // If there is dynamic attributes, we pass them to the comparison manager
72 72
         // When a comparison will be performed, the passed values will be retrieved and used
73
-        if(isset($options['dynamic_attributes'])) {
73
+        if (isset($options['dynamic_attributes'])) {
74 74
             $this->comparisonManager->setDynamicAttributes($options['dynamic_attributes']);
75 75
         }
76 76
         // Retrieve cache value for the current rule and values if cache item is valid
77
-        if(($cacheResult = isset($options['cache_result']) && $options['cache_result'] === true) === true) {
77
+        if (($cacheResult = isset($options['cache_result']) && $options['cache_result'] === true) === true) {
78 78
             $cacheItem = $this->cacheManager->getItem(
79
-                "$ruleName-{$user->getId()}-" . (($resource !== null) ? $resource->getId() : ''),
79
+                "$ruleName-{$user->getId()}-".(($resource !== null) ? $resource->getId() : ''),
80 80
                 (isset($options['cache_driver'])) ? $options['cache_driver'] : null,
81 81
                 (isset($options['cache_ttl'])) ? $options['cache_ttl'] : null
82 82
             );
83 83
             // We check if the cache value s valid before returning it
84
-            if(($cacheValue = $cacheItem->get()) !== null) {
84
+            if (($cacheValue = $cacheItem->get()) !== null) {
85 85
                 return $cacheValue;
86 86
             }
87 87
         }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         foreach ($policyRule->getPolicyRuleAttributes() as $pra) {
91 91
             $attribute = $pra->getAttribute();
92 92
             $attribute->setValue($this->attributeManager->retrieveAttribute($attribute, $user, $resource));
93
-            if(count($pra->getExtraData()) > 0) {
93
+            if (count($pra->getExtraData()) > 0) {
94 94
                 $this->processExtraData($pra, $user, $resource);
95 95
             }
96 96
             $this->comparisonManager->compare($pra);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         // The given result could be an array of rejected attributes or true
99 99
         // True means that the rule is correctly enforced for the given user and resource
100 100
         $result = $this->comparisonManager->getResult();
101
-        if($cacheResult) {
101
+        if ($cacheResult) {
102 102
             $cacheItem->set($result);
103 103
             $this->cacheManager->save($cacheItem);
104 104
         }
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
      * @param object $resource
112 112
      */
113 113
     public function processExtraData(PolicyRuleAttribute $pra, $user, $resource) {
114
-        foreach($pra->getExtraData() as $key => $data) {
115
-            switch($key) {
114
+        foreach ($pra->getExtraData() as $key => $data) {
115
+            switch ($key) {
116 116
                 case 'with':
117 117
                     // This data has to be removed for it will be stored elsewhere
118 118
                     // in the policy rule attribute
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
                     // The "with" extra data is an array of attributes, which are objects
121 121
                     // Once we process it as policy rule attributes, we set it as the main policy rule attribute value
122 122
                     $subPolicyRuleAttributes = [];
123
-                    foreach($this->policyRuleManager->processRuleAttributes($data) as $subPolicyRuleAttribute) {
123
+                    foreach ($this->policyRuleManager->processRuleAttributes($data) as $subPolicyRuleAttribute) {
124 124
                         $subPolicyRuleAttributes[] = $subPolicyRuleAttribute;
125 125
                     }
126 126
                     $pra->setValue($subPolicyRuleAttributes);
Please login to merge, or discard this patch.
src/Model/PolicyRuleAttribute.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
     }
29 29
 
30 30
     /**
31
-     * @return \PhpAbac\Model\AbstractAttribute
31
+     * @return string
32 32
      */
33 33
     public function getAttribute()
34 34
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@
 block discarded – undo
121 121
      * @return \PhpAbac\Model\PolicyRuleAttribute
122 122
      */
123 123
     public function removeExtraData($key) {
124
-        if(isset($this->extraData[$key])) {
124
+        if (isset($this->extraData[$key])) {
125 125
             unset($this->extraData[$key]);
126 126
         }
127 127
         return $this;
Please login to merge, or discard this patch.
example.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     $user1Vehicle = $abac->enforce('vehicle-homologation', $users[0], $vehicles[0], [
35 35
         'dynamic_attributes' => ['proprietaire' => 1]
36 36
     ]);
37
-    if($user1Vehicle === true) {
37
+    if ($user1Vehicle === true) {
38 38
         echo("GRANTED : The vehicle 1 is able to be approved for the user 1\n");
39 39
     } else {
40 40
         echo("FAIL : The system didn't grant access\n");
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     $user3Vehicle = $abac->enforce('vehicle-homologation', $users[2], $vehicles[1], [
43 43
         'dynamic_attributes' => ['proprietaire' => 3]
44 44
     ]);
45
-    if(!$user3Vehicle !== true) {
45
+    if (!$user3Vehicle !== true) {
46 46
         echo("DENIED : The vehicle 2 is not approved for the user 3 because its last technical review is too old\n");
47 47
     } else {
48 48
         echo("FAIL : The system didn't deny access\n");
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     $user4Vehicle = $abac->enforce('vehicle-homologation', $users[3], $vehicles[3], [
51 51
         'dynamic_attributes' => ['proprietaire' => 4]
52 52
     ]);
53
-    if($user4Vehicle !== true) {
53
+    if ($user4Vehicle !== true) {
54 54
         echo("DENIED : The vehicle 4 is not able to be approved for the user 4 because he has no driving license\n");
55 55
     } else {
56 56
         echo("FAIL : The system didn't deny access\n");
@@ -58,19 +58,19 @@  discard block
 block discarded – undo
58 58
     $user5Vehicle = $abac->enforce('vehicle-homologation', $users[3], $vehicles[3], [
59 59
         'dynamic_attributes' => ['proprietaire' => 1]
60 60
     ]);
61
-    if($user5Vehicle !== true) {
61
+    if ($user5Vehicle !== true) {
62 62
         echo("DENIED : The vehicle 4 is not able to be approved for the user 2 because he doesn't own the vehicle\n");
63 63
     } else {
64 64
         echo("FAIL : The system didn't deny access\n");
65 65
     }
66 66
     $userTravel1 = $abac->enforce('travel-to-usa', $users[0]);
67
-    if($userTravel1 !== true) {
67
+    if ($userTravel1 !== true) {
68 68
         echo("DENIED: The user 1 is not allowed to travel to the USA because he doesn't have an US visa\n");
69 69
     } else {
70 70
         echo('FAIL: The system didn\'t deny access');
71 71
     }
72 72
     $userTravel2 = $abac->enforce('travel-to-usa', $users[1]);
73
-    if($userTravel2 === true) {
73
+    if ($userTravel2 === true) {
74 74
         echo("GRANTED: The user 2 is allowed to travel to the USA\n");
75 75
     } else {
76 76
         echo('FAIL: The system didn\'t deny access');
Please login to merge, or discard this patch.
src/Manager/PolicyRuleManager.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function getRule($ruleName)
34 34
     {
35
-        if(!isset($this->rules[$ruleName])) {
36
-            throw new \InvalidArgumentException('The given rule "' . $ruleName . '" is not configured');
35
+        if (!isset($this->rules[$ruleName])) {
36
+            throw new \InvalidArgumentException('The given rule "'.$ruleName.'" is not configured');
37 37
         }
38 38
         $rule =
39 39
             (new PolicyRule())
40 40
             ->setName($ruleName)
41 41
         ;
42
-        foreach($this->processRuleAttributes($this->rules[$ruleName]['attributes']) as $pra) {
42
+        foreach ($this->processRuleAttributes($this->rules[$ruleName]['attributes']) as $pra) {
43 43
             $rule->addPolicyRuleAttribute($pra);
44 44
         }
45 45
         return $rule;
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
      * @param array $attributes
50 50
      */
51 51
     public function processRuleAttributes($attributes) {
52
-        foreach($attributes as $attributeName => $attribute) {
52
+        foreach ($attributes as $attributeName => $attribute) {
53 53
             $pra = (new PolicyRuleAttribute())
54 54
                 ->setAttribute($this->attributeManager->getAttribute($attributeName))
55 55
                 ->setComparison($attribute['comparison'])
56 56
                 ->setComparisonType($attribute['comparison_type'])
57 57
                 ->setValue((isset($attribute['value'])) ? $attribute['value'] : null)
58 58
             ;
59
-            foreach($attribute as $key => $value) {
60
-                if(!in_array($key, ['comparison', 'comparison_type', 'value'])) {
59
+            foreach ($attribute as $key => $value) {
60
+                if (!in_array($key, ['comparison', 'comparison_type', 'value'])) {
61 61
                     $pra->addExtraData($key, $value);
62 62
                 }
63 63
             }
Please login to merge, or discard this patch.