@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function addRole(string $role): PermissionManager |
74 | 74 | { |
75 | - if ($this->hasRole($role)) { |
|
75 | + if ($this->hasRole($role)){ |
|
76 | 76 | throw new RoleException("Role '{$role}' already exists"); |
77 | 77 | } |
78 | 78 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function removeRole(string $role): PermissionManager |
92 | 92 | { |
93 | - if (!$this->hasRole($role)) { |
|
93 | + if (!$this->hasRole($role)){ |
|
94 | 94 | throw new RoleException("Undefined role '{$role}'"); |
95 | 95 | } |
96 | 96 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function getPermissions(string $role): array |
114 | 114 | { |
115 | - if (!$this->hasRole($role)) { |
|
115 | + if (!$this->hasRole($role)){ |
|
116 | 116 | throw new RoleException("Undefined role '{$role}'"); |
117 | 117 | } |
118 | 118 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function getRule(string $role, string $permission): RuleInterface |
126 | 126 | { |
127 | - if (!$this->hasRole($role)) { |
|
127 | + if (!$this->hasRole($role)){ |
|
128 | 128 | throw new RoleException("Undefined role '{$role}'"); |
129 | 129 | } |
130 | 130 | |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function associate(string $role, string $permission, string $rule = AllowRule::class): PermissionManager |
141 | 141 | { |
142 | - if (!$this->hasRole($role)) { |
|
142 | + if (!$this->hasRole($role)){ |
|
143 | 143 | throw new RoleException("Undefined role '{$role}'"); |
144 | 144 | } |
145 | 145 | |
146 | - if (!$this->rules->has($rule)) { |
|
146 | + if (!$this->rules->has($rule)){ |
|
147 | 147 | throw new PermissionException("Undefined rule '{$rule}'"); |
148 | 148 | } |
149 | 149 | |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | */ |
177 | 177 | private function findRule(string $role, string $permission): string |
178 | 178 | { |
179 | - if (isset($this->permissions[$role][$permission])) { |
|
179 | + if (isset($this->permissions[$role][$permission])){ |
|
180 | 180 | //O(1) check |
181 | 181 | return $this->permissions[$role][$permission]; |
182 | 182 | } |
183 | 183 | |
184 | 184 | //Matching using star syntax |
185 | - foreach ($this->permissions[$role] as $pattern => $rule) { |
|
186 | - if ($this->matcher->matches($permission, $pattern)) { |
|
185 | + foreach ($this->permissions[$role] as $pattern => $rule){ |
|
186 | + if ($this->matcher->matches($permission, $pattern)){ |
|
187 | 187 | return $rule; |
188 | 188 | } |
189 | 189 | } |
@@ -72,7 +72,8 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function addRole(string $role): PermissionManager |
74 | 74 | { |
75 | - if ($this->hasRole($role)) { |
|
75 | + if ($this->hasRole($role)) |
|
76 | + { |
|
76 | 77 | throw new RoleException("Role '{$role}' already exists"); |
77 | 78 | } |
78 | 79 | |
@@ -90,7 +91,8 @@ discard block |
||
90 | 91 | */ |
91 | 92 | public function removeRole(string $role): PermissionManager |
92 | 93 | { |
93 | - if (!$this->hasRole($role)) { |
|
94 | + if (!$this->hasRole($role)) |
|
95 | + { |
|
94 | 96 | throw new RoleException("Undefined role '{$role}'"); |
95 | 97 | } |
96 | 98 | |
@@ -112,7 +114,8 @@ discard block |
||
112 | 114 | */ |
113 | 115 | public function getPermissions(string $role): array |
114 | 116 | { |
115 | - if (!$this->hasRole($role)) { |
|
117 | + if (!$this->hasRole($role)) |
|
118 | + { |
|
116 | 119 | throw new RoleException("Undefined role '{$role}'"); |
117 | 120 | } |
118 | 121 | |
@@ -124,7 +127,8 @@ discard block |
||
124 | 127 | */ |
125 | 128 | public function getRule(string $role, string $permission): RuleInterface |
126 | 129 | { |
127 | - if (!$this->hasRole($role)) { |
|
130 | + if (!$this->hasRole($role)) |
|
131 | + { |
|
128 | 132 | throw new RoleException("Undefined role '{$role}'"); |
129 | 133 | } |
130 | 134 | |
@@ -139,11 +143,13 @@ discard block |
||
139 | 143 | */ |
140 | 144 | public function associate(string $role, string $permission, string $rule = AllowRule::class): PermissionManager |
141 | 145 | { |
142 | - if (!$this->hasRole($role)) { |
|
146 | + if (!$this->hasRole($role)) |
|
147 | + { |
|
143 | 148 | throw new RoleException("Undefined role '{$role}'"); |
144 | 149 | } |
145 | 150 | |
146 | - if (!$this->rules->has($rule)) { |
|
151 | + if (!$this->rules->has($rule)) |
|
152 | + { |
|
147 | 153 | throw new PermissionException("Undefined rule '{$rule}'"); |
148 | 154 | } |
149 | 155 | |
@@ -176,14 +182,17 @@ discard block |
||
176 | 182 | */ |
177 | 183 | private function findRule(string $role, string $permission): string |
178 | 184 | { |
179 | - if (isset($this->permissions[$role][$permission])) { |
|
185 | + if (isset($this->permissions[$role][$permission])) |
|
186 | + { |
|
180 | 187 | //O(1) check |
181 | 188 | return $this->permissions[$role][$permission]; |
182 | 189 | } |
183 | 190 | |
184 | 191 | //Matching using star syntax |
185 | - foreach ($this->permissions[$role] as $pattern => $rule) { |
|
186 | - if ($this->matcher->matches($permission, $pattern)) { |
|
192 | + foreach ($this->permissions[$role] as $pattern => $rule) |
|
193 | + { |
|
194 | + if ($this->matcher->matches($permission, $pattern)) |
|
195 | + { |
|
187 | 196 | return $rule; |
188 | 197 | } |
189 | 198 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | PermissionsInterface $permissions, |
37 | 37 | ActorInterface $actor = null, |
38 | 38 | array $roles = [] |
39 | - ) { |
|
39 | + ){ |
|
40 | 40 | $this->roles = $roles; |
41 | 41 | $this->actor = $actor; |
42 | 42 | $this->permissions = $permissions; |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | public function allows(string $permission, array $context = []): bool |
49 | 49 | { |
50 | 50 | $allows = false; |
51 | - foreach ($this->getRoles() as $role) { |
|
52 | - if (!$this->permissions->hasRole($role)) { |
|
51 | + foreach ($this->getRoles() as $role){ |
|
52 | + if (!$this->permissions->hasRole($role)){ |
|
53 | 53 | continue; |
54 | 54 | } |
55 | 55 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function getActor(): ActorInterface |
97 | 97 | { |
98 | - if (empty($this->actor)) { |
|
98 | + if (empty($this->actor)){ |
|
99 | 99 | throw new GuardException('Unable to get Guard Actor, no value set'); |
100 | 100 | } |
101 | 101 |
@@ -48,8 +48,10 @@ discard block |
||
48 | 48 | public function allows(string $permission, array $context = []): bool |
49 | 49 | { |
50 | 50 | $allows = false; |
51 | - foreach ($this->getRoles() as $role) { |
|
52 | - if (!$this->permissions->hasRole($role)) { |
|
51 | + foreach ($this->getRoles() as $role) |
|
52 | + { |
|
53 | + if (!$this->permissions->hasRole($role)) |
|
54 | + { |
|
53 | 55 | continue; |
54 | 56 | } |
55 | 57 | |
@@ -95,7 +97,8 @@ discard block |
||
95 | 97 | */ |
96 | 98 | public function getActor(): ActorInterface |
97 | 99 | { |
98 | - if (empty($this->actor)) { |
|
100 | + if (empty($this->actor)) |
|
101 | + { |
|
99 | 102 | throw new GuardException('Unable to get Guard Actor, no value set'); |
100 | 103 | } |
101 | 104 |
@@ -40,10 +40,10 @@ |
||
40 | 40 | */ |
41 | 41 | public function matches(string $string, string $pattern): bool |
42 | 42 | { |
43 | - if ($string === $pattern) { |
|
43 | + if ($string === $pattern){ |
|
44 | 44 | return true; |
45 | 45 | } |
46 | - if (!$this->isPattern($pattern)) { |
|
46 | + if (!$this->isPattern($pattern)){ |
|
47 | 47 | return false; |
48 | 48 | } |
49 | 49 | return (bool)preg_match($this->getRegex($pattern), $string); |
@@ -40,10 +40,12 @@ |
||
40 | 40 | */ |
41 | 41 | public function matches(string $string, string $pattern): bool |
42 | 42 | { |
43 | - if ($string === $pattern) { |
|
43 | + if ($string === $pattern) |
|
44 | + { |
|
44 | 45 | return true; |
45 | 46 | } |
46 | - if (!$this->isPattern($pattern)) { |
|
47 | + if (!$this->isPattern($pattern)) |
|
48 | + { |
|
47 | 49 | return false; |
48 | 50 | } |
49 | 51 | return (bool)preg_match($this->getRegex($pattern), $string); |
@@ -54,16 +54,16 @@ |
||
54 | 54 | public function allows(ActorInterface $actor, string $permission, array $context): bool |
55 | 55 | { |
56 | 56 | $allowed = 0; |
57 | - foreach (static::RULES as $rule) { |
|
57 | + foreach (static::RULES as $rule){ |
|
58 | 58 | $rule = $this->repository->get($rule); |
59 | 59 | |
60 | - if ($rule->allows($actor, $permission, $context)) { |
|
61 | - if (static::BEHAVIOUR == self::AT_LEAST_ONE) { |
|
60 | + if ($rule->allows($actor, $permission, $context)){ |
|
61 | + if (static::BEHAVIOUR == self::AT_LEAST_ONE){ |
|
62 | 62 | return true; |
63 | 63 | } |
64 | 64 | |
65 | 65 | $allowed++; |
66 | - } elseif (static::BEHAVIOUR == self::ALL) { |
|
66 | + } elseif (static::BEHAVIOUR == self::ALL){ |
|
67 | 67 | return false; |
68 | 68 | } |
69 | 69 | } |
@@ -54,16 +54,21 @@ |
||
54 | 54 | public function allows(ActorInterface $actor, string $permission, array $context): bool |
55 | 55 | { |
56 | 56 | $allowed = 0; |
57 | - foreach (static::RULES as $rule) { |
|
57 | + foreach (static::RULES as $rule) |
|
58 | + { |
|
58 | 59 | $rule = $this->repository->get($rule); |
59 | 60 | |
60 | - if ($rule->allows($actor, $permission, $context)) { |
|
61 | - if (static::BEHAVIOUR == self::AT_LEAST_ONE) { |
|
61 | + if ($rule->allows($actor, $permission, $context)) |
|
62 | + { |
|
63 | + if (static::BEHAVIOUR == self::AT_LEAST_ONE) |
|
64 | + { |
|
62 | 65 | return true; |
63 | 66 | } |
64 | 67 | |
65 | 68 | $allowed++; |
66 | - } elseif (static::BEHAVIOUR == self::ALL) { |
|
69 | + } |
|
70 | + elseif (static::BEHAVIOUR == self::ALL) |
|
71 | + { |
|
67 | 72 | return false; |
68 | 73 | } |
69 | 74 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | public function addElement(DeclarationInterface $element): NamespaceDeclaration |
59 | 59 | { |
60 | 60 | $this->elements->add($element); |
61 | - if ($element instanceof DependedInterface) { |
|
61 | + if ($element instanceof DependedInterface){ |
|
62 | 62 | $this->addUses($element->getDependencies()); |
63 | 63 | } |
64 | 64 | |
@@ -85,23 +85,23 @@ discard block |
||
85 | 85 | $result = ''; |
86 | 86 | $indentShift = 0; |
87 | 87 | |
88 | - if (!$this->docComment->isEmpty()) { |
|
89 | - $result .= $this->docComment->render($indentLevel) . "\n"; |
|
88 | + if (!$this->docComment->isEmpty()){ |
|
89 | + $result .= $this->docComment->render($indentLevel)."\n"; |
|
90 | 90 | } |
91 | 91 | |
92 | - if (!empty($this->getName())) { |
|
93 | - $result .= $this->addIndent("namespace {$this->getName()} {", $indentLevel) . "\n"; |
|
92 | + if (!empty($this->getName())){ |
|
93 | + $result .= $this->addIndent("namespace {$this->getName()} {", $indentLevel)."\n"; |
|
94 | 94 | $indentShift = 1; |
95 | 95 | } |
96 | 96 | |
97 | - if (!empty($this->uses)) { |
|
98 | - $result .= $this->renderUses($indentLevel + $indentShift) . "\n\n"; |
|
97 | + if (!empty($this->uses)){ |
|
98 | + $result .= $this->renderUses($indentLevel + $indentShift)."\n\n"; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | $result .= $this->elements->render($indentLevel + $indentShift); |
102 | 102 | |
103 | - if (!empty($this->getName())) { |
|
104 | - $result .= "\n" . $this->addIndent('}', $indentLevel); |
|
103 | + if (!empty($this->getName())){ |
|
104 | + $result .= "\n".$this->addIndent('}', $indentLevel); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | return $result; |
@@ -58,7 +58,8 @@ discard block |
||
58 | 58 | public function addElement(DeclarationInterface $element): NamespaceDeclaration |
59 | 59 | { |
60 | 60 | $this->elements->add($element); |
61 | - if ($element instanceof DependedInterface) { |
|
61 | + if ($element instanceof DependedInterface) |
|
62 | + { |
|
62 | 63 | $this->addUses($element->getDependencies()); |
63 | 64 | } |
64 | 65 | |
@@ -85,22 +86,26 @@ discard block |
||
85 | 86 | $result = ''; |
86 | 87 | $indentShift = 0; |
87 | 88 | |
88 | - if (!$this->docComment->isEmpty()) { |
|
89 | + if (!$this->docComment->isEmpty()) |
|
90 | + { |
|
89 | 91 | $result .= $this->docComment->render($indentLevel) . "\n"; |
90 | 92 | } |
91 | 93 | |
92 | - if (!empty($this->getName())) { |
|
94 | + if (!empty($this->getName())) |
|
95 | + { |
|
93 | 96 | $result .= $this->addIndent("namespace {$this->getName()} {", $indentLevel) . "\n"; |
94 | 97 | $indentShift = 1; |
95 | 98 | } |
96 | 99 | |
97 | - if (!empty($this->uses)) { |
|
100 | + if (!empty($this->uses)) |
|
101 | + { |
|
98 | 102 | $result .= $this->renderUses($indentLevel + $indentShift) . "\n\n"; |
99 | 103 | } |
100 | 104 | |
101 | 105 | $result .= $this->elements->render($indentLevel + $indentShift); |
102 | 106 | |
103 | - if (!empty($this->getName())) { |
|
107 | + if (!empty($this->getName())) |
|
108 | + { |
|
104 | 109 | $result .= "\n" . $this->addIndent('}', $indentLevel); |
105 | 110 | } |
106 | 111 |
@@ -106,7 +106,8 @@ discard block |
||
106 | 106 | public function addElement(DeclarationInterface $element): FileDeclaration |
107 | 107 | { |
108 | 108 | $this->elements->add($element); |
109 | - if ($element instanceof DependedInterface) { |
|
109 | + if ($element instanceof DependedInterface) |
|
110 | + { |
|
110 | 111 | $this->addUses($element->getDependencies()); |
111 | 112 | } |
112 | 113 | |
@@ -132,22 +133,27 @@ discard block |
||
132 | 133 | { |
133 | 134 | $result = "<?php\n"; |
134 | 135 | |
135 | - if (!$this->docComment->isEmpty()) { |
|
136 | + if (!$this->docComment->isEmpty()) |
|
137 | + { |
|
136 | 138 | $result .= $this->docComment->render($indentLevel) . "\n"; |
137 | 139 | } |
138 | 140 | |
139 | - if ($this->directives !== null && !empty($this->directives->render())) { |
|
141 | + if ($this->directives !== null && !empty($this->directives->render())) |
|
142 | + { |
|
140 | 143 | $result .= $this->directives->render() . "\n\n"; |
141 | 144 | } |
142 | 145 | |
143 | - if (!empty($this->namespace)) { |
|
144 | - if ($this->docComment->isEmpty()) { |
|
146 | + if (!empty($this->namespace)) |
|
147 | + { |
|
148 | + if ($this->docComment->isEmpty()) |
|
149 | + { |
|
145 | 150 | $result .= "\n"; |
146 | 151 | } |
147 | 152 | $result .= "namespace {$this->namespace};\n\n"; |
148 | 153 | } |
149 | 154 | |
150 | - if (!empty($this->uses)) { |
|
155 | + if (!empty($this->uses)) |
|
156 | + { |
|
151 | 157 | $result .= $this->renderUses($indentLevel) . "\n\n"; |
152 | 158 | } |
153 | 159 |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | public function addElement(DeclarationInterface $element): FileDeclaration |
81 | 81 | { |
82 | 82 | $this->elements->add($element); |
83 | - if ($element instanceof DependedInterface) { |
|
83 | + if ($element instanceof DependedInterface){ |
|
84 | 84 | $this->addUses($element->getDependencies()); |
85 | 85 | } |
86 | 86 | |
@@ -105,28 +105,28 @@ discard block |
||
105 | 105 | { |
106 | 106 | $result = "<?php\n"; |
107 | 107 | |
108 | - if (!$this->docComment->isEmpty()) { |
|
109 | - $result .= $this->docComment->render($indentLevel) . "\n"; |
|
108 | + if (!$this->docComment->isEmpty()){ |
|
109 | + $result .= $this->docComment->render($indentLevel)."\n"; |
|
110 | 110 | } |
111 | 111 | |
112 | - if ($this->directives !== null && !empty($this->directives->render())) { |
|
113 | - $result .= $this->directives->render() . "\n\n"; |
|
112 | + if ($this->directives !== null && !empty($this->directives->render())){ |
|
113 | + $result .= $this->directives->render()."\n\n"; |
|
114 | 114 | } |
115 | 115 | |
116 | - if (!empty($this->namespace)) { |
|
117 | - if ($this->docComment->isEmpty()) { |
|
116 | + if (!empty($this->namespace)){ |
|
117 | + if ($this->docComment->isEmpty()){ |
|
118 | 118 | $result .= "\n"; |
119 | 119 | } |
120 | 120 | $result .= "namespace {$this->namespace};\n\n"; |
121 | 121 | } |
122 | 122 | |
123 | - if (!empty($this->uses)) { |
|
124 | - $result .= $this->renderUses($indentLevel) . "\n\n"; |
|
123 | + if (!empty($this->uses)){ |
|
124 | + $result .= $this->renderUses($indentLevel)."\n\n"; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | $result .= $this->elements->render($indentLevel); |
128 | 128 | |
129 | - return $result . "\n"; |
|
129 | + return $result."\n"; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function setComment($comment): self |
44 | 44 | { |
45 | - if (!empty($comment)) { |
|
46 | - if (is_array($comment)) { |
|
45 | + if (!empty($comment)){ |
|
46 | + if (is_array($comment)){ |
|
47 | 47 | $this->docComment->setLines($comment); |
48 | - } elseif (is_string($comment)) { |
|
48 | + } elseif (is_string($comment)){ |
|
49 | 49 | $this->docComment->setString($comment); |
50 | 50 | } |
51 | 51 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | private function initComment($comment): void |
62 | 62 | { |
63 | - if (empty($this->docComment)) { |
|
63 | + if (empty($this->docComment)){ |
|
64 | 64 | $this->docComment = new Comment(); |
65 | 65 | } |
66 | 66 |
@@ -42,10 +42,14 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function setComment($comment): self |
44 | 44 | { |
45 | - if (!empty($comment)) { |
|
46 | - if (is_array($comment)) { |
|
45 | + if (!empty($comment)) |
|
46 | + { |
|
47 | + if (is_array($comment)) |
|
48 | + { |
|
47 | 49 | $this->docComment->setLines($comment); |
48 | - } elseif (is_string($comment)) { |
|
50 | + } |
|
51 | + elseif (is_string($comment)) |
|
52 | + { |
|
49 | 53 | $this->docComment->setString($comment); |
50 | 54 | } |
51 | 55 | } |
@@ -60,7 +64,8 @@ discard block |
||
60 | 64 | */ |
61 | 65 | private function initComment($comment): void |
62 | 66 | { |
63 | - if (empty($this->docComment)) { |
|
67 | + if (empty($this->docComment)) |
|
68 | + { |
|
64 | 69 | $this->docComment = new Comment(); |
65 | 70 | } |
66 | 71 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function addUses(array $uses): self |
58 | 58 | { |
59 | - foreach ($uses as $class => $alias) { |
|
59 | + foreach ($uses as $class => $alias){ |
|
60 | 60 | $this->addUse($class, $alias); |
61 | 61 | } |
62 | 62 | |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | private function renderUses(int $indentLevel = 0): string |
113 | 113 | { |
114 | 114 | $lines = []; |
115 | - foreach ($this->getUses() as $class => $alias) { |
|
115 | + foreach ($this->getUses() as $class => $alias){ |
|
116 | 116 | $line = "use {$class}"; |
117 | 117 | |
118 | - if (!empty($alias)) { |
|
118 | + if (!empty($alias)){ |
|
119 | 119 | $line .= " as {$alias};"; |
120 | - } else { |
|
120 | + }else{ |
|
121 | 121 | $line .= ';'; |
122 | 122 | } |
123 | 123 |
@@ -56,7 +56,8 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function addUses(array $uses): self |
58 | 58 | { |
59 | - foreach ($uses as $class => $alias) { |
|
59 | + foreach ($uses as $class => $alias) |
|
60 | + { |
|
60 | 61 | $this->addUse($class, $alias); |
61 | 62 | } |
62 | 63 | |
@@ -112,12 +113,16 @@ discard block |
||
112 | 113 | private function renderUses(int $indentLevel = 0): string |
113 | 114 | { |
114 | 115 | $lines = []; |
115 | - foreach ($this->getUses() as $class => $alias) { |
|
116 | + foreach ($this->getUses() as $class => $alias) |
|
117 | + { |
|
116 | 118 | $line = "use {$class}"; |
117 | 119 | |
118 | - if (!empty($alias)) { |
|
120 | + if (!empty($alias)) |
|
121 | + { |
|
119 | 122 | $line .= " as {$alias};"; |
120 | - } else { |
|
123 | + } |
|
124 | + else |
|
125 | + { |
|
121 | 126 | $line .= ';'; |
122 | 127 | } |
123 | 128 |
@@ -38,12 +38,14 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function render(int $indentLevel = 0): string |
40 | 40 | { |
41 | - if ($this->isEmpty()) { |
|
41 | + if ($this->isEmpty()) |
|
42 | + { |
|
42 | 43 | return ''; |
43 | 44 | } |
44 | 45 | |
45 | 46 | $result = $this->addIndent("/**\n", $indentLevel); |
46 | - foreach ($this->getLines() as $line) { |
|
47 | + foreach ($this->getLines() as $line) |
|
48 | + { |
|
47 | 49 | $result .= $this->addIndent(" * {$line}\n", $indentLevel); |
48 | 50 | } |
49 | 51 | |
@@ -58,7 +60,8 @@ discard block |
||
58 | 60 | protected function prepareLine(string $line): ?string |
59 | 61 | { |
60 | 62 | $line = trim($line); |
61 | - if (in_array($line, ['/*', '/**', '*/'], true)) { |
|
63 | + if (in_array($line, ['/*', '/**', '*/'], true)) |
|
64 | + { |
|
62 | 65 | return null; |
63 | 66 | } |
64 | 67 |
@@ -37,16 +37,16 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function render(int $indentLevel = 0): string |
39 | 39 | { |
40 | - if ($this->isEmpty()) { |
|
40 | + if ($this->isEmpty()){ |
|
41 | 41 | return ''; |
42 | 42 | } |
43 | 43 | |
44 | 44 | $result = $this->addIndent("/**\n", $indentLevel); |
45 | - foreach ($this->getLines() as $line) { |
|
45 | + foreach ($this->getLines() as $line){ |
|
46 | 46 | $result .= $this->addIndent(" * {$line}\n", $indentLevel); |
47 | 47 | } |
48 | 48 | |
49 | - return $result . $this->addIndent(' */', $indentLevel); |
|
49 | + return $result.$this->addIndent(' */', $indentLevel); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | protected function prepareLine(string $line): ?string |
56 | 56 | { |
57 | 57 | $line = trim($line); |
58 | - if (in_array($line, ['/*', '/**', '*/'], true)) { |
|
58 | + if (in_array($line, ['/*', '/**', '*/'], true)){ |
|
59 | 59 | return null; |
60 | 60 | } |
61 | 61 |