| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 198 | 
| Code Lines | 96 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 47 | public function providerForTestGetPermissionsCriterion()  | 
            ||
| 48 |     { | 
            ||
| 49 | $criterionMock = $this  | 
            ||
| 50 | ->getMockBuilder(Criterion::class)  | 
            ||
| 51 | ->disableOriginalConstructor()  | 
            ||
| 52 | ->getMock();  | 
            ||
| 53 | $limitationMock = $this  | 
            ||
| 54 | ->getMockBuilder(Limitation::class)  | 
            ||
| 55 | ->getMockForAbstractClass();  | 
            ||
| 56 | $limitationMock  | 
            ||
| 57 | ->expects($this->any())  | 
            ||
| 58 |             ->method('getIdentifier') | 
            ||
| 59 |             ->will($this->returnValue('limitationIdentifier')); | 
            ||
| 60 | |||
| 61 | $policy1 = new Policy(['limitations' => [$limitationMock]]);  | 
            ||
| 62 | $policy2 = new Policy(['limitations' => [$limitationMock, $limitationMock]]);  | 
            ||
| 63 | |||
| 64 | return [  | 
            ||
| 65 | [  | 
            ||
| 66 | $criterionMock,  | 
            ||
| 67 | 1,  | 
            ||
| 68 | [  | 
            ||
| 69 | [  | 
            ||
| 70 | 'limitation' => null,  | 
            ||
| 71 | 'policies' => [$policy1],  | 
            ||
| 72 | ],  | 
            ||
| 73 | ],  | 
            ||
| 74 | $criterionMock,  | 
            ||
| 75 | ],  | 
            ||
| 76 | [  | 
            ||
| 77 | $criterionMock,  | 
            ||
| 78 | 2,  | 
            ||
| 79 | [  | 
            ||
| 80 | [  | 
            ||
| 81 | 'limitation' => null,  | 
            ||
| 82 | 'policies' => [$policy1, $policy1],  | 
            ||
| 83 | ],  | 
            ||
| 84 | ],  | 
            ||
| 85 | new Criterion\LogicalOr([$criterionMock, $criterionMock]),  | 
            ||
| 86 | ],  | 
            ||
| 87 | [  | 
            ||
| 88 | $criterionMock,  | 
            ||
| 89 | 0,  | 
            ||
| 90 | [  | 
            ||
| 91 | [  | 
            ||
| 92 | 'limitation' => null,  | 
            ||
| 93 | 'policies' => [new Policy(['limitations' => '*']), $policy1],  | 
            ||
| 94 | ],  | 
            ||
| 95 | ],  | 
            ||
| 96 | false,  | 
            ||
| 97 | ],  | 
            ||
| 98 | [  | 
            ||
| 99 | $criterionMock,  | 
            ||
| 100 | 0,  | 
            ||
| 101 | [  | 
            ||
| 102 | [  | 
            ||
| 103 | 'limitation' => null,  | 
            ||
| 104 | 'policies' => [new Policy(['limitations' => []]), $policy1],  | 
            ||
| 105 | ],  | 
            ||
| 106 | ],  | 
            ||
| 107 | false,  | 
            ||
| 108 | ],  | 
            ||
| 109 | [  | 
            ||
| 110 | $criterionMock,  | 
            ||
| 111 | 2,  | 
            ||
| 112 | [  | 
            ||
| 113 | [  | 
            ||
| 114 | 'limitation' => null,  | 
            ||
| 115 | 'policies' => [$policy2],  | 
            ||
| 116 | ],  | 
            ||
| 117 | ],  | 
            ||
| 118 | new Criterion\LogicalAnd([$criterionMock, $criterionMock]),  | 
            ||
| 119 | ],  | 
            ||
| 120 | [  | 
            ||
| 121 | $criterionMock,  | 
            ||
| 122 | 3,  | 
            ||
| 123 | [  | 
            ||
| 124 | [  | 
            ||
| 125 | 'limitation' => null,  | 
            ||
| 126 | 'policies' => [$policy1, $policy2],  | 
            ||
| 127 | ],  | 
            ||
| 128 | ],  | 
            ||
| 129 | new Criterion\LogicalOr(  | 
            ||
| 130 | [  | 
            ||
| 131 | $criterionMock,  | 
            ||
| 132 | new Criterion\LogicalAnd([$criterionMock, $criterionMock]),  | 
            ||
| 133 | ]  | 
            ||
| 134 | ),  | 
            ||
| 135 | ],  | 
            ||
| 136 | [  | 
            ||
| 137 | $criterionMock,  | 
            ||
| 138 | 2,  | 
            ||
| 139 | [  | 
            ||
| 140 | [  | 
            ||
| 141 | 'limitation' => null,  | 
            ||
| 142 | 'policies' => [$policy1],  | 
            ||
| 143 | ],  | 
            ||
| 144 | [  | 
            ||
| 145 | 'limitation' => null,  | 
            ||
| 146 | 'policies' => [$policy1],  | 
            ||
| 147 | ],  | 
            ||
| 148 | ],  | 
            ||
| 149 | new Criterion\LogicalOr([$criterionMock, $criterionMock]),  | 
            ||
| 150 | ],  | 
            ||
| 151 | [  | 
            ||
| 152 | $criterionMock,  | 
            ||
| 153 | 3,  | 
            ||
| 154 | [  | 
            ||
| 155 | [  | 
            ||
| 156 | 'limitation' => null,  | 
            ||
| 157 | 'policies' => [$policy1],  | 
            ||
| 158 | ],  | 
            ||
| 159 | [  | 
            ||
| 160 | 'limitation' => null,  | 
            ||
| 161 | 'policies' => [$policy1, $policy1],  | 
            ||
| 162 | ],  | 
            ||
| 163 | ],  | 
            ||
| 164 | new Criterion\LogicalOr([$criterionMock, $criterionMock, $criterionMock]),  | 
            ||
| 165 | ],  | 
            ||
| 166 | [  | 
            ||
| 167 | $criterionMock,  | 
            ||
| 168 | 3,  | 
            ||
| 169 | [  | 
            ||
| 170 | [  | 
            ||
| 171 | 'limitation' => null,  | 
            ||
| 172 | 'policies' => [$policy2],  | 
            ||
| 173 | ],  | 
            ||
| 174 | [  | 
            ||
| 175 | 'limitation' => null,  | 
            ||
| 176 | 'policies' => [$policy1],  | 
            ||
| 177 | ],  | 
            ||
| 178 | ],  | 
            ||
| 179 | new Criterion\LogicalOr(  | 
            ||
| 180 | [  | 
            ||
| 181 | new Criterion\LogicalAnd([$criterionMock, $criterionMock]),  | 
            ||
| 182 | $criterionMock,  | 
            ||
| 183 | ]  | 
            ||
| 184 | ),  | 
            ||
| 185 | ],  | 
            ||
| 186 | [  | 
            ||
| 187 | $criterionMock,  | 
            ||
| 188 | 2,  | 
            ||
| 189 | [  | 
            ||
| 190 | [  | 
            ||
| 191 | 'limitation' => $limitationMock,  | 
            ||
| 192 | 'policies' => [$policy1],  | 
            ||
| 193 | ],  | 
            ||
| 194 | ],  | 
            ||
| 195 | new Criterion\LogicalAnd([$criterionMock, $criterionMock]),  | 
            ||
| 196 | ],  | 
            ||
| 197 | [  | 
            ||
| 198 | $criterionMock,  | 
            ||
| 199 | 4,  | 
            ||
| 200 | [  | 
            ||
| 201 | [  | 
            ||
| 202 | 'limitation' => $limitationMock,  | 
            ||
| 203 | 'policies' => [$policy1],  | 
            ||
| 204 | ],  | 
            ||
| 205 | [  | 
            ||
| 206 | 'limitation' => $limitationMock,  | 
            ||
| 207 | 'policies' => [$policy1],  | 
            ||
| 208 | ],  | 
            ||
| 209 | ],  | 
            ||
| 210 | new Criterion\LogicalOr(  | 
            ||
| 211 | [  | 
            ||
| 212 | new Criterion\LogicalAnd([$criterionMock, $criterionMock]),  | 
            ||
| 213 | new Criterion\LogicalAnd([$criterionMock, $criterionMock]),  | 
            ||
| 214 | ]  | 
            ||
| 215 | ),  | 
            ||
| 216 | ],  | 
            ||
| 217 | [  | 
            ||
| 218 | $criterionMock,  | 
            ||
| 219 | 1,  | 
            ||
| 220 | [  | 
            ||
| 221 | [  | 
            ||
| 222 | 'limitation' => $limitationMock,  | 
            ||
| 223 | 'policies' => [new Policy(['limitations' => '*'])],  | 
            ||
| 224 | ],  | 
            ||
| 225 | ],  | 
            ||
| 226 | $criterionMock,  | 
            ||
| 227 | ],  | 
            ||
| 228 | [  | 
            ||
| 229 | $criterionMock,  | 
            ||
| 230 | 2,  | 
            ||
| 231 | [  | 
            ||
| 232 | [  | 
            ||
| 233 | 'limitation' => $limitationMock,  | 
            ||
| 234 | 'policies' => [new Policy(['limitations' => '*'])],  | 
            ||
| 235 | ],  | 
            ||
| 236 | [  | 
            ||
| 237 | 'limitation' => $limitationMock,  | 
            ||
| 238 | 'policies' => [new Policy(['limitations' => '*'])],  | 
            ||
| 239 | ],  | 
            ||
| 240 | ],  | 
            ||
| 241 | new Criterion\LogicalOr([$criterionMock, $criterionMock]),  | 
            ||
| 242 | ],  | 
            ||
| 243 | ];  | 
            ||
| 244 | }  | 
            ||
| 245 | |||
| 386 |