| Conditions | 4 |
| Paths | 5 |
| Total Lines | 22 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | protected function inlineSection($excerpt): ?array |
||
| 24 | { |
||
| 25 | if (preg_match('/^(@@?) ?(.+[^:]):(.+\.(php|html))/', $excerpt['text'], $matches)) { |
||
| 26 | $class = strlen($matches[1]) == 1 ? 'section-site' : 'section-method'; |
||
| 27 | $element = strlen($matches[1]) == 1 ? 'a' : 'button'; |
||
| 28 | |||
| 29 | return [ |
||
| 30 | 'extent' => strlen($matches[0]), |
||
| 31 | 'element' => [ |
||
| 32 | 'name' => $element, |
||
| 33 | 'text' => $matches[2], |
||
| 34 | 'attributes' => [ |
||
| 35 | 'data-section-src' => $matches[3], |
||
| 36 | 'class' => $class, |
||
| 37 | 'data-target' => Strings::webalize($matches[2]) |
||
| 38 | ] |
||
| 39 | ] |
||
| 40 | ]; |
||
| 41 | } |
||
| 42 | |||
| 43 | return null; |
||
| 44 | } |
||
| 45 | } |
||
| 46 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.