| Conditions | 13 |
| Paths | 11 |
| Total Lines | 46 |
| Code Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 8 | ||
| Bugs | 0 | Features | 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 |
||
| 53 | public function getMyLink(?string $fieldNameAppendix = ''): ?string |
||
| 54 | { |
||
| 55 | $linkTypeFieldName = 'LinkType' . $fieldNameAppendix; |
||
| 56 | |||
| 57 | $InternalLinkMethodName = 'InternalLink' . $fieldNameAppendix; |
||
| 58 | $internalLinkFieldName = $InternalLinkMethodName . 'ID'; |
||
| 59 | |||
| 60 | $downloadLinkMethodName = 'DownloadFile' . $fieldNameAppendix; |
||
| 61 | $downloadLinkFieldName = $downloadLinkMethodName . 'ID'; |
||
| 62 | |||
| 63 | $externalLinkFieldName = 'ExternalLink' . $fieldNameAppendix; |
||
| 64 | if ('Internal' === $this->owner->{$linkTypeFieldName} && $this->owner->{$internalLinkFieldName}) { |
||
| 65 | $obj = $this->owner->{$InternalLinkMethodName}(); |
||
| 66 | if ($obj) { |
||
| 67 | return $obj->Link(); |
||
| 68 | } |
||
| 69 | } elseif ('DownloadFile' === $this->owner->{$linkTypeFieldName} && $this->owner->{$downloadLinkFieldName}) { |
||
| 70 | $obj = $this->owner->{$downloadLinkMethodName}(); |
||
| 71 | if ($obj) { |
||
| 72 | return $obj->Link(); |
||
| 73 | } |
||
| 74 | } elseif ($this->owner->{$externalLinkFieldName}) { |
||
| 75 | if ('External' === $this->owner->{$linkTypeFieldName}) { |
||
| 76 | return DBField::create_field('Varchar', $this->owner->{$externalLinkFieldName})->url(); |
||
| 77 | } |
||
| 78 | |||
| 79 | if ('Email' === $this->owner->{$linkTypeFieldName}) { |
||
| 80 | $val = $this->owner->{$externalLinkFieldName}; |
||
| 81 | if (class_exists(\Sunnysideup\EmailAddressDatabaseField\Model\Fieldtypes\EmailAddress::class)) { |
||
| 82 | $val = DBField::create_field('EmailAddress', $val)->HiddenEmailAddress()->RAW(); |
||
| 83 | } |
||
| 84 | |||
| 85 | return 'mailto:' . $val; |
||
| 86 | } |
||
| 87 | |||
| 88 | if ('Phone' === $this->owner->{$linkTypeFieldName}) { |
||
| 89 | $val = $this->owner->{$externalLinkFieldName}; |
||
| 90 | if (class_exists(\Sunnysideup\PhoneField\Model\Fieldtypes\PhoneField::class)) { |
||
| 91 | $val = DBField::create_field('PhoneField', $this->owner->{$externalLinkFieldName})->IntlFormat()->Raw(); |
||
| 92 | } |
||
| 93 | |||
| 94 | return 'callto:' . $val; |
||
| 95 | } |
||
| 96 | } |
||
| 97 | |||
| 98 | return null; |
||
| 99 | } |
||
| 217 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths