| Conditions | 1 |
| Paths | 1 |
| Total Lines | 51 |
| Code Lines | 48 |
| 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 |
||
| 82 | public function getValidUrls() |
||
| 83 | { |
||
| 84 | return [ |
||
| 85 | ['http://a.pl'], |
||
| 86 | ['http://www.google.com'], |
||
| 87 | ['http://www.google.com.'], |
||
| 88 | ['http://www.google.museum'], |
||
| 89 | ['https://google.com/'], |
||
| 90 | ['https://google.com:80/'], |
||
| 91 | ['http://www.example.coop/'], |
||
| 92 | ['http://www.test-example.com/'], |
||
| 93 | ['http://www.symfony.com/'], |
||
| 94 | ['http://symfony.fake/blog/'], |
||
| 95 | ['http://symfony.com/?'], |
||
| 96 | ['http://symfony.com/search?type=&q=url+validator'], |
||
| 97 | ['http://symfony.com/#'], |
||
| 98 | ['http://symfony.com/#?'], |
||
| 99 | ['http://www.symfony.com/doc/current/book/validation.html#supported-constraints'], |
||
| 100 | ['http://very.long.domain.name.com/'], |
||
| 101 | ['http://localhost/'], |
||
| 102 | ['http://myhost123/'], |
||
| 103 | ['http://127.0.0.1/'], |
||
| 104 | ['http://127.0.0.1:80/'], |
||
| 105 | ['http://[::1]/'], |
||
| 106 | ['http://[::1]:80/'], |
||
| 107 | ['http://[1:2:3::4:5:6:7]/'], |
||
| 108 | ['http://xn--sopaulo-xwa.com/'], |
||
| 109 | ['http://xn--sopaulo-xwa.com.br/'], |
||
| 110 | ['http://xn--e1afmkfd.xn--80akhbyknj4f/'], |
||
| 111 | ['http://xn--mgbh0fb.xn--kgbechtv/'], |
||
| 112 | ['http://xn--fsqu00a.xn--0zwm56d/'], |
||
| 113 | ['http://xn--fsqu00a.xn--g6w251d/'], |
||
| 114 | ['http://xn--r8jz45g.xn--zckzah/'], |
||
| 115 | ['http://xn--mgbh0fb.xn--hgbk6aj7f53bba/'], |
||
| 116 | ['http://xn--9n2bp8q.xn--9t4b11yi5a/'], |
||
| 117 | ['http://xn--ogb.idn.icann.org/'], |
||
| 118 | ['http://xn--e1afmkfd.xn--80akhbyknj4f.xn--e1afmkfd/'], |
||
| 119 | ['http://xn--espaa-rta.xn--ca-ol-fsay5a/'], |
||
| 120 | ['http://xn--d1abbgf6aiiy.xn--p1ai/'], |
||
| 121 | ['http://username:[email protected]'], |
||
| 122 | ['http://[email protected]'], |
||
| 123 | ['http://symfony.com?'], |
||
| 124 | ['http://symfony.com?query=1'], |
||
| 125 | ['http://symfony.com/?query=1'], |
||
| 126 | ['http://symfony.com#'], |
||
| 127 | ['http://symfony.com#fragment'], |
||
| 128 | ['http://symfony.com/#fragment'], |
||
| 129 | ['http://symfony.com/#one_more%20test'], |
||
| 130 | ['custom-scheme://symfony.com'], |
||
| 131 | ]; |
||
| 132 | } |
||
| 133 | |||
| 231 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@returnannotation as described here.