| Conditions | 1 |
| Paths | 1 |
| Total Lines | 55 |
| Code Lines | 42 |
| 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 |
||
| 88 | public function testIdplistStructured(): void |
||
| 89 | { |
||
| 90 | $refl = new ReflectionClass($this->discoHandler); |
||
| 91 | $idplistStructured = $refl->getMethod('idplistStructured'); |
||
| 92 | $idplistStructured->setAccessible(true); |
||
| 93 | $idpList = $idplistStructured->invokeArgs($this->discoHandler, [$this->idpList]); |
||
| 94 | |||
| 95 | $expected = [ |
||
| 96 | 'B' => [ |
||
| 97 | 'https://idp04.example.org' => [ |
||
| 98 | 'name' => ['en' => 'IdP 04'], |
||
| 99 | 'tags' => ['A', 'B'], |
||
| 100 | 'entityid' => 'https://idp04.example.org', |
||
| 101 | 'UIInfo' => ['Keywords' => ['en' => ['aap','noot','mies']]], |
||
| 102 | ], |
||
| 103 | 'https://idp06.example.org' => [ |
||
| 104 | 'name' => ['en' => 'IdP 06'], |
||
| 105 | 'tags' => ['B'], |
||
| 106 | 'entityid' => 'https://idp06.example.org', |
||
| 107 | 'UIInfo' => ['Keywords' => ['fr' => ['singue','noix','mies'], 'de' => ['Affe', 'Nuss', 'mies']]], |
||
| 108 | ], |
||
| 109 | 'https://idp05.example.org' => [ |
||
| 110 | 'tags' => ['B'], |
||
| 111 | 'entityid' => 'https://idp05.example.org' |
||
| 112 | ], |
||
| 113 | ], |
||
| 114 | 'A' => [ |
||
| 115 | 'https://idp03.example.org' => [ |
||
| 116 | 'name' => ['en' => 'IdP 03'], |
||
| 117 | 'discopower.weight' => 100, |
||
| 118 | 'tags' => ['A'], |
||
| 119 | 'entityid' => 'https://idp03.example.org' |
||
| 120 | ], |
||
| 121 | 'https://idp02.example.org' => [ |
||
| 122 | 'name' => ['en' => 'IdP 02'], |
||
| 123 | 'tags' => ['A'], |
||
| 124 | 'entityid' => 'https://idp02.example.org' |
||
| 125 | ], |
||
| 126 | 'https://idp04.example.org' => [ |
||
| 127 | 'name' => ['en' => 'IdP 04'], |
||
| 128 | 'tags' => ['A','B',], |
||
| 129 | 'entityid' => 'https://idp04.example.org', |
||
| 130 | 'UIInfo' => ['Keywords' => ['en' => ['aap','noot','mies']]], |
||
| 131 | ], |
||
| 132 | 'https://idp01.example.org' => [ |
||
| 133 | 'name' => ['en' => 'IdP 01'], |
||
| 134 | 'discopower.weight' => 1, |
||
| 135 | 'tags' => ['A'], |
||
| 136 | 'entityid' => 'https://idp01.example.org' |
||
| 137 | ], |
||
| 138 | ], |
||
| 139 | ]; |
||
| 140 | $this->assertEquals($expected, $idpList); |
||
| 141 | $this->assertEquals($expected['A'], $idpList['A']); |
||
| 142 | $this->assertEquals($expected['B'], $idpList['B']); |
||
| 143 | } |
||
| 192 |