| Conditions | 1 |
| Paths | 1 |
| Total Lines | 85 |
| Code Lines | 69 |
| 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 |
||
| 14 | public function goodLocalBusiness() |
||
| 15 | { |
||
| 16 | return array( |
||
| 17 | array( |
||
| 18 | array(), |
||
| 19 | array( |
||
| 20 | 'base' => 'http://linkeddata.center/botk/resource/', |
||
| 21 | 'lang' => 'it', |
||
| 22 | 'addressCountry' => 'IT', |
||
| 23 | ), |
||
| 24 | ), |
||
| 25 | |||
| 26 | array( |
||
| 27 | array( |
||
| 28 | 'base' => 'http://linkeddata.center/botk/resource#', |
||
| 29 | 'lang' => 'en', |
||
| 30 | 'addressCountry' => 'US', |
||
| 31 | ), |
||
| 32 | array( |
||
| 33 | 'base' => 'http://linkeddata.center/botk/resource#', |
||
| 34 | 'lang' => 'en', |
||
| 35 | 'addressCountry' => 'US', |
||
| 36 | ), |
||
| 37 | ), |
||
| 38 | |||
| 39 | array( |
||
| 40 | array( |
||
| 41 | 'id' => '1234567890', |
||
| 42 | 'taxID' => 'fgn nrc 63S0 6F205 A', |
||
| 43 | 'vatID' => '01234567890', |
||
| 44 | 'legalName' => 'Test soc srl', |
||
| 45 | 'alternateName' => 'Test soc srl', |
||
| 46 | 'addressCountry' => 'IT', |
||
| 47 | 'addressLocality' => 'LECCO', |
||
| 48 | 'addressRegion' => 'LC', |
||
| 49 | 'streetAddress' => 'Via F. Valsecchi,124', |
||
| 50 | 'postalCode' => '23900', |
||
| 51 | 'page' => 'http://linkeddata.center/', |
||
| 52 | 'telephone' => '+39 3356382949', |
||
| 53 | 'faxNumber' => '0341 255188 ', |
||
| 54 | 'email' => '[email protected]', |
||
| 55 | 'geoDescription' => 'Via F. Valsecchi,124-23900 Lecco (LC)', |
||
| 56 | 'lat' => '1.12345', |
||
| 57 | 'long' => '2.123456', |
||
| 58 | ), |
||
| 59 | array( |
||
| 60 | 'base' => 'http://linkeddata.center/botk/resource/', |
||
| 61 | 'lang' => 'it', |
||
| 62 | 'id' => '1234567890', |
||
| 63 | 'taxID' => 'FGNNRC63S06F205A', |
||
| 64 | 'vatID' => '01234567890', |
||
| 65 | 'legalName' => 'TEST SOC SRL', |
||
| 66 | 'alternateName' => 'Test soc srl', |
||
| 67 | 'addressCountry' => 'IT', |
||
| 68 | 'addressLocality' => 'LECCO', |
||
| 69 | 'addressRegion' => 'LC', |
||
| 70 | 'streetAddress' => 'VIA F.VALSECCHI, 124', |
||
| 71 | 'postalCode' => '23900', |
||
| 72 | 'page' => 'http://linkeddata.center/', |
||
| 73 | 'telephone' => '3356382949', |
||
| 74 | 'faxNumber' => '0341255188', |
||
| 75 | 'email' => '[email protected]', |
||
| 76 | 'geoDescription' => 'VIA F.VALSECCHI, 124 - 23900 LECCO (LC)', |
||
| 77 | 'lat' => '1.12345', |
||
| 78 | 'long' => '2.123456', |
||
| 79 | ), |
||
| 80 | ), |
||
| 81 | array( |
||
| 82 | array( |
||
| 83 | 'id' => '1234567890', |
||
| 84 | 'taxID' => '', |
||
| 85 | 'vatID' => '', |
||
| 86 | 'legalName' => null, |
||
| 87 | 'alternateName' => '', |
||
| 88 | 'addressCountry' => null, |
||
| 89 | ), |
||
| 90 | array( |
||
| 91 | 'base' => 'http://linkeddata.center/botk/resource/', |
||
| 92 | 'lang' => 'it', |
||
| 93 | 'id' => '1234567890', |
||
| 94 | 'addressCountry' => 'IT', |
||
| 95 | ), |
||
| 96 | ), |
||
| 97 | ); |
||
| 98 | } |
||
| 99 | |||
| 246 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.