| Conditions | 1 |
| Paths | 1 |
| Total Lines | 53 |
| Code Lines | 39 |
| 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 |
||
| 34 | public function update(Configuration $baseConfiguration, Configuration $newConfiguration) |
||
| 35 | { |
||
| 36 | return new Configuration( |
||
| 37 | $this->plainValueUpdater->update( |
||
| 38 | $newConfiguration->getPackageName(), |
||
| 39 | $baseConfiguration->getPackageName() |
||
| 40 | ), |
||
| 41 | $this->plainValueUpdater->update( |
||
| 42 | $newConfiguration->getType(), |
||
| 43 | $baseConfiguration->getType() |
||
| 44 | ), |
||
| 45 | $this->plainValueUpdater->update( |
||
| 46 | $newConfiguration->getLicense(), |
||
| 47 | $baseConfiguration->getLicense() |
||
| 48 | ), |
||
| 49 | $this->plainValueUpdater->update( |
||
| 50 | $newConfiguration->getPackageVersion(), |
||
| 51 | $baseConfiguration->getPackageVersion() |
||
| 52 | ), |
||
| 53 | $this->plainValueUpdater->update( |
||
| 54 | $newConfiguration->getDescription(), |
||
| 55 | $baseConfiguration->getDescription() |
||
| 56 | ), |
||
| 57 | $this->keywordListUpdater->update( |
||
| 58 | $newConfiguration->getKeywordList(), |
||
| 59 | $baseConfiguration->getKeywordList() |
||
| 60 | ), |
||
| 61 | $this->authorListUpdater->update($newConfiguration->getAuthorList(), $baseConfiguration->getAuthorList()), |
||
| 62 | $this->listUpdater->update( |
||
| 63 | $newConfiguration->getProvidedPackageList(), |
||
| 64 | $baseConfiguration->getProvidedPackageList() |
||
| 65 | ), |
||
| 66 | $this->listUpdater->update( |
||
| 67 | $newConfiguration->getSuggestedPackageList(), |
||
| 68 | $baseConfiguration->getSuggestedPackageList() |
||
| 69 | ), |
||
| 70 | $this->listUpdater->update($newConfiguration->getSupportList(), $baseConfiguration->getSupportList()), |
||
| 71 | $this->listUpdater->update($newConfiguration->getAutoloadList(), $baseConfiguration->getAutoloadList()), |
||
| 72 | $this->listUpdater->update( |
||
| 73 | $newConfiguration->getAutoloadDevList(), |
||
| 74 | $baseConfiguration->getAutoloadDevList() |
||
| 75 | ), |
||
| 76 | $this->listUpdater->update( |
||
| 77 | $newConfiguration->getRequiredPackageList(), |
||
| 78 | $baseConfiguration->getRequiredPackageList() |
||
| 79 | ), |
||
| 80 | $this->listUpdater->update( |
||
| 81 | $newConfiguration->getRequiredDevPackageList(), |
||
| 82 | $baseConfiguration->getRequiredDevPackageList() |
||
| 83 | ), |
||
| 84 | $this->listUpdater->update($newConfiguration->getScriptList(), $baseConfiguration->getScriptList()) |
||
| 85 | ); |
||
| 86 | } |
||
| 87 | } |
||
| 88 |