Conditions | 8 |
Paths | 20 |
Total Lines | 51 |
Code Lines | 26 |
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 |
||
83 | private function resolveComparisonResults(array $patchConstraints, array $packages, array $rootRequires) |
||
84 | { |
||
85 | $comparisonResults = array(); |
||
86 | |||
87 | foreach ($patchConstraints as $constraintTarget => $version) { |
||
88 | if (!isset($packages[$constraintTarget])) { |
||
89 | continue; |
||
90 | } |
||
91 | |||
92 | $package = $packages[$constraintTarget]; |
||
93 | |||
94 | $packageVersion = $package->getVersion(); |
||
95 | $packageVersions = array($package->getVersion()); |
||
96 | |||
97 | if (isset($rootRequires[$constraintTarget])) { |
||
98 | /** @var \Composer\Package\CompletePackageInterface $targetRootPackage */ |
||
99 | $targetRootPackage = $rootRequires[$constraintTarget]; |
||
100 | |||
101 | preg_match('/.* as (.*)$/', $targetRootPackage->getPrettyConstraint(), $matches); |
||
|
|||
102 | |||
103 | if (isset($matches[1])) { |
||
104 | $packageVersions[] = $matches[1]; |
||
105 | } |
||
106 | } |
||
107 | |||
108 | if ($this->constraintUtils->isDevConstraint($packageVersion)) { |
||
109 | $definedVersion = $this->configExtractor->getConfig( |
||
110 | $package, |
||
111 | 'version' |
||
112 | ); |
||
113 | |||
114 | $packageVersions[] = $definedVersion; |
||
115 | } |
||
116 | |||
117 | $matchResult = false; |
||
118 | |||
119 | foreach (array_filter($packageVersions) as $packageVersion) { |
||
120 | $packageConstraint = $this->versionParser->parseConstraints($packageVersion); |
||
121 | $patchConstraint = $this->versionParser->parseConstraints($version); |
||
122 | |||
123 | $matchResult = $patchConstraint->matches($packageConstraint); |
||
124 | |||
125 | if ($matchResult) { |
||
126 | break; |
||
127 | } |
||
128 | } |
||
129 | |||
130 | $comparisonResults[] = $matchResult; |
||
131 | } |
||
132 | |||
133 | return $comparisonResults; |
||
134 | } |
||
136 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.