| Conditions | 12 |
| Paths | 192 |
| Total Lines | 55 |
| Code Lines | 33 |
| 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 |
||
| 67 | public function resolveDepsInternalTag(\ReflectionClass $reflectionClass): array |
||
| 68 | { |
||
| 69 | $ret = []; |
||
| 70 | |||
| 71 | if ($this->haveTag($reflectionClass, self::DEPS_INTERNAL)) { |
||
| 72 | try { |
||
| 73 | $ret[] = new DepsInternal( |
||
| 74 | FQSEN::createClass($reflectionClass->getName()), |
||
| 75 | $this->resolve($reflectionClass->getDocComment(), self::DEPS_INTERNAL) |
||
|
|
|||
| 76 | ); |
||
| 77 | } catch (InvalidFullyQualifiedStructureElementNameException $e) { |
||
| 78 | $this->notifyError($reflectionClass->getFileName(), $reflectionClass->getName(), $e); |
||
| 79 | } |
||
| 80 | } |
||
| 81 | |||
| 82 | foreach ($reflectionClass->getProperties() as $reflectionProperty) { |
||
| 83 | if ($this->haveTag($reflectionProperty, self::DEPS_INTERNAL)) { |
||
| 84 | try { |
||
| 85 | $ret[] = new DepsInternal( |
||
| 86 | FQSEN::createProperty($reflectionClass->getName(), $reflectionProperty->getName()), |
||
| 87 | $this->resolve($reflectionProperty->getDocComment(), self::DEPS_INTERNAL) |
||
| 88 | ); |
||
| 89 | } catch (InvalidFullyQualifiedStructureElementNameException $e) { |
||
| 90 | $this->notifyError($reflectionClass->getFileName(), $reflectionClass->getName(), $e); |
||
| 91 | } |
||
| 92 | } |
||
| 93 | } |
||
| 94 | |||
| 95 | foreach ($reflectionClass->getMethods() as $reflectionMethod) { |
||
| 96 | if ($this->haveTag($reflectionMethod, self::DEPS_INTERNAL)) { |
||
| 97 | try { |
||
| 98 | $ret[] = new DepsInternal( |
||
| 99 | FQSEN::createMethod($reflectionClass->getName(), $reflectionMethod->getName()), |
||
| 100 | $this->resolve($reflectionMethod->getDocComment(), self::DEPS_INTERNAL) |
||
| 101 | ); |
||
| 102 | } catch (InvalidFullyQualifiedStructureElementNameException $e) { |
||
| 103 | $this->notifyError($reflectionClass->getFileName(), $reflectionClass->getName(), $e); |
||
| 104 | } |
||
| 105 | } |
||
| 106 | } |
||
| 107 | |||
| 108 | foreach ($reflectionClass->getReflectionConstants() as $reflectionClassConstant) { |
||
| 109 | if ($this->haveTag($reflectionClassConstant, self::DEPS_INTERNAL)) { |
||
| 110 | try { |
||
| 111 | $ret[] = new DepsInternal( |
||
| 112 | FQSEN::createClassConstant($reflectionClass->getName(), $reflectionClassConstant->getName()), |
||
| 113 | $this->resolve($reflectionClassConstant->getDocComment(), self::DEPS_INTERNAL) |
||
| 114 | ); |
||
| 115 | } catch (InvalidFullyQualifiedStructureElementNameException $e) { |
||
| 116 | $this->notifyError($reflectionClass->getFileName(), $reflectionClass->getName(), $e); |
||
| 117 | } |
||
| 118 | } |
||
| 119 | } |
||
| 120 | |||
| 121 | return $ret; |
||
| 122 | } |
||
| 231 |