| Conditions | 1 |
| Paths | 1 |
| Total Lines | 85 |
| Code Lines | 46 |
| 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 /** @noinspection PhpUndefinedFieldInspection */ |
||
| 36 | public function __construct($overwrites = []) |
||
| 37 | {
|
||
| 38 | $abnf = new Rfc4234; |
||
|
|
|||
| 39 | |||
| 40 | $ipv6 = new Rfc3513; |
||
| 41 | |||
| 42 | /* |
||
| 43 | * Normal rules |
||
| 44 | */ |
||
| 45 | $rules = [ |
||
| 46 | // 4.5. Selecting Records |
||
| 47 | 'record' => [$this->version, $this->terms, $this->SP], |
||
| 48 | 'version' => 'v=spf1', |
||
| 49 | |||
| 50 | // 4.6.1. Term Evaluation |
||
| 51 | 'terms' => star([plus($abnf->SP), c($this->directive, $this->modifier)]), |
||
| 52 | 'directive' => [opt($this->qualifier), $this->mechanism], |
||
| 53 | 'qualifier' => set('+-?~'),
|
||
| 54 | 'mechanism' => c($this->all, $this->include, $this->A, $this->MX, $this->PTR, $this->IP4, $this->IP6, |
||
| 55 | $this->exists), // @todo order? |
||
| 56 | 'modifier' => c($this->redirect, $this->explanation, $this->unknown_modifier), |
||
| 57 | 'unknown_modifier' => [$this->name, '=', $this->macro_string], |
||
| 58 | 'name' => [$abnf->ALPHA, star(c($abnf->ALPHA, $abnf->DIGIT, '-', '_', '.'))], |
||
| 59 | |||
| 60 | // 5.1. "all" |
||
| 61 | 'all' => 'all', |
||
| 62 | |||
| 63 | // 5.2. "include" |
||
| 64 | 'include' => ['include', ':', $this->domain_spec], |
||
| 65 | |||
| 66 | // 5.3. "a" |
||
| 67 | 'A' => ['a', opt(s(':', $this->domain_spec)), opt($this->dual_cidr_length)],
|
||
| 68 | |||
| 69 | // 5.4. "mx" |
||
| 70 | 'MX' => ['mx', opt(s(':', $this->domain_spec)), opt($this->dual_cidr_length)],
|
||
| 71 | |||
| 72 | // 5.5. "ptr" |
||
| 73 | 'PTR' => ['ptr', ':', $this->domain_spec], |
||
| 74 | |||
| 75 | // 5.6. "ip4" and "ip6" |
||
| 76 | 'IP4' => ['ip4', ':', $this->ip4_network, opt($this->ip4_cidr_length)], |
||
| 77 | 'IP6' => ['ip6', ':', ":", $this->ip6_network, opt($this->ip6_cidr_length)], |
||
| 78 | 'ip4_cidr_length' => ['/', plus($abnf->DIGIT)], |
||
| 79 | 'ip6_cidr_length' => ['/', plus($abnf->DIGIT)], |
||
| 80 | 'dual_cidr_length' => [opt($this->ip4_cidr_length), opt(['/', $this->ip6_cidr_length])], |
||
| 81 | 'ip4_network' => [$this->qnum, '.', $this->qnum, '.', $this->qnum, '.', $this->qnum], |
||
| 82 | 'qnum' => new Integer(0, 255), |
||
| 83 | 'ip6_network' => $ipv6->ipv6_address, |
||
| 84 | |||
| 85 | // 5.7. "exists" |
||
| 86 | 'exists' => ['exists', ':', $this->domain_spec], |
||
| 87 | |||
| 88 | // 6.1. redirect: Redirected Query |
||
| 89 | 'redirect' => ['redirect', '=', $this->domain_spec], |
||
| 90 | |||
| 91 | // 6.2. exp: Explanation |
||
| 92 | 'explanation' => ['exp', '=', $this->domain_spec], |
||
| 93 | |||
| 94 | // 8. Macros |
||
| 95 | 'domain_spec' => [$this->macro_string, $this->domain_end], |
||
| 96 | 'domain_end' => c(['.', $this->toplabel, opt('.')], $this->macro_expand),
|
||
| 97 | 'toplabel' => c( |
||
| 98 | [star($this->alphanum), $abnf->ALPHA, star($this->alphanum)], |
||
| 99 | [plus($this->alphanum), '=', star(c($this->alphanum, '-')), $this->alphanum] |
||
| 100 | ), // LDH rule plus additional TLD restrictions (see [RFC3696], Section 2) @todo Read & implement |
||
| 101 | 'alphanum' => c($abnf->ALPHA, $abnf->DIGIT), |
||
| 102 | 'explain_string' => star(c($this->macro_string, $abnf->SP)), |
||
| 103 | 'macro_string' => star(c($this->macro_expand, $this->macro_literal)), |
||
| 104 | 'macro_expand' => c( |
||
| 105 | ['%{', $this->macro_letter, $this->transformers, star($this->delimiter), '}'],
|
||
| 106 | '%%', '%_', '%-' |
||
| 107 | ), |
||
| 108 | 'macro_literal' => c(range(0x21, 0x24), range(0x26, 0x7E)), |
||
| 109 | 'macro_letter' => set('slodiphcrt'),
|
||
| 110 | 'transformers' => [star($abnf->DIGIT), opt('r')],
|
||
| 111 | 'delimiter' => set('.-+,/_='),
|
||
| 112 | |||
| 113 | // 7. The Received-SPF Header Field |
||
| 114 | // Implement as separate ruleset? |
||
| 115 | // Does it conflict with the record definition? |
||
| 116 | |||
| 117 | self::DEFAULT => $this->record, |
||
| 118 | ]; |
||
| 119 | |||
| 120 | parent::__construct(array_merge($rules, $overwrites)); |
||
| 121 | } |
||
| 122 | } |
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