| Conditions | 1 |
| Paths | 1 |
| Total Lines | 72 |
| Code Lines | 61 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 2 | Features | 2 |
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 |
||
| 26 | protected function setUp() |
||
| 27 | { |
||
| 28 | $this->fields = array( |
||
| 29 | ExtractorInterface::FIELD_UNIQUE_ID, |
||
| 30 | ExtractorInterface::FIELD_USERNAME, |
||
| 31 | ExtractorInterface::FIELD_FIRST_NAME, |
||
| 32 | ExtractorInterface::FIELD_LAST_NAME, |
||
| 33 | ExtractorInterface::FIELD_FULL_NAME, |
||
| 34 | ExtractorInterface::FIELD_EMAIL, |
||
| 35 | ExtractorInterface::FIELD_DESCRIPTION, |
||
| 36 | ExtractorInterface::FIELD_LOCATION, |
||
| 37 | ExtractorInterface::FIELD_PROFILE_URL, |
||
| 38 | ExtractorInterface::FIELD_IMAGE_URL, |
||
| 39 | ExtractorInterface::FIELD_WEBSITES, |
||
| 40 | ExtractorInterface::FIELD_VERIFIED_EMAIL, |
||
| 41 | ExtractorInterface::FIELD_EXTRA |
||
| 42 | ); |
||
| 43 | |||
| 44 | $this->fieldSupportFunctions = array( |
||
| 45 | ExtractorInterface::FIELD_UNIQUE_ID => 'supportsUniqueId', |
||
| 46 | ExtractorInterface::FIELD_USERNAME => 'supportsUsername', |
||
| 47 | ExtractorInterface::FIELD_FIRST_NAME => 'supportsFirstName', |
||
| 48 | ExtractorInterface::FIELD_LAST_NAME => 'supportsLastName', |
||
| 49 | ExtractorInterface::FIELD_FULL_NAME => 'supportsFullName', |
||
| 50 | ExtractorInterface::FIELD_EMAIL => 'supportsEmail', |
||
| 51 | ExtractorInterface::FIELD_DESCRIPTION => 'supportsDescription', |
||
| 52 | ExtractorInterface::FIELD_LOCATION => 'supportsLocation', |
||
| 53 | ExtractorInterface::FIELD_PROFILE_URL => 'supportsProfileUrl', |
||
| 54 | ExtractorInterface::FIELD_IMAGE_URL => 'supportsImageUrl', |
||
| 55 | ExtractorInterface::FIELD_WEBSITES => 'supportsWebsites', |
||
| 56 | ExtractorInterface::FIELD_VERIFIED_EMAIL => 'supportsVerifiedEmail', |
||
| 57 | ExtractorInterface::FIELD_EXTRA => 'supportsExtra', |
||
| 58 | ); |
||
| 59 | |||
| 60 | $this->fieldGetFunctions = array( |
||
| 61 | ExtractorInterface::FIELD_UNIQUE_ID => 'getUniqueId', |
||
| 62 | ExtractorInterface::FIELD_USERNAME => 'getUsername', |
||
| 63 | ExtractorInterface::FIELD_FIRST_NAME => 'getFirstName', |
||
| 64 | ExtractorInterface::FIELD_LAST_NAME => 'getLastName', |
||
| 65 | ExtractorInterface::FIELD_FULL_NAME => 'getFullName', |
||
| 66 | ExtractorInterface::FIELD_EMAIL => 'getEmail', |
||
| 67 | ExtractorInterface::FIELD_DESCRIPTION => 'getDescription', |
||
| 68 | ExtractorInterface::FIELD_LOCATION => 'getLocation', |
||
| 69 | ExtractorInterface::FIELD_PROFILE_URL => 'getProfileUrl', |
||
| 70 | ExtractorInterface::FIELD_IMAGE_URL => 'getImageUrl', |
||
| 71 | ExtractorInterface::FIELD_WEBSITES => 'getWebsites', |
||
| 72 | ExtractorInterface::FIELD_VERIFIED_EMAIL => 'isEmailVerified', |
||
| 73 | ExtractorInterface::FIELD_EXTRA => 'getExtras', |
||
| 74 | ); |
||
| 75 | |||
| 76 | $this->fieldValues = array( |
||
| 77 | ExtractorInterface::FIELD_UNIQUE_ID => '1234567', |
||
| 78 | ExtractorInterface::FIELD_USERNAME => 'johnnydonny', |
||
| 79 | ExtractorInterface::FIELD_FIRST_NAME => 'john', |
||
| 80 | ExtractorInterface::FIELD_LAST_NAME => 'doe', |
||
| 81 | ExtractorInterface::FIELD_FULL_NAME => 'john doe', |
||
| 82 | ExtractorInterface::FIELD_EMAIL => '[email protected]', |
||
| 83 | ExtractorInterface::FIELD_DESCRIPTION => 'A life on the edge', |
||
| 84 | ExtractorInterface::FIELD_LOCATION => 'Rome, Italy', |
||
| 85 | ExtractorInterface::FIELD_PROFILE_URL => 'http://social.co/johnnydonny', |
||
| 86 | ExtractorInterface::FIELD_IMAGE_URL => 'http://social.co/avatar/johnnydonny.jpg', |
||
| 87 | ExtractorInterface::FIELD_WEBSITES => array( |
||
| 88 | 'http://johnnydonny.com', |
||
| 89 | 'http://blog.johnnydonny.com', |
||
| 90 | ), |
||
| 91 | ExtractorInterface::FIELD_VERIFIED_EMAIL => true, |
||
| 92 | ExtractorInterface::FIELD_EXTRA => array( |
||
| 93 | 'foo' => 'bar', |
||
| 94 | 'skills' => array('php', 'symfony', 'butterflies') |
||
| 95 | ), |
||
| 96 | ); |
||
| 97 | } |
||
| 98 | |||
| 161 |