Conditions | 2 |
Paths | 1 |
Total Lines | 25 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
59 | public function parse(): ContentHeadersRenderer |
||
60 | { |
||
61 | $this->links = []; |
||
62 | |||
63 | $this->content = preg_replace_callback('/<(h\d+)>(.*?)<\/h\d+>/isu', function ($data) { |
||
64 | list($data, $tag, $header) = $data; |
||
|
|||
65 | $id = Str::slug($header); |
||
66 | |||
67 | foreach ($this->tags as $from => $to) { |
||
68 | $tag = str_replace($from, $to, $tag); |
||
69 | } |
||
70 | |||
71 | $this->links[] = [ |
||
72 | 'anchor' => $id, |
||
73 | 'title' => $header, |
||
74 | 'level' => $tag, |
||
75 | ]; |
||
76 | |||
77 | $link = '<%s><a href="#%s" class="anchor" name="%s"></a>%s</%s>'; |
||
78 | |||
79 | return sprintf($link, $tag, $id, $id, $header, $tag); |
||
80 | }, $this->body); |
||
81 | |||
82 | return $this; |
||
83 | } |
||
84 | |||
101 |
This checks looks for assignemnts to variables using the
list(...)
function, where not all assigned variables are subsequently used.Consider the following code example.
Only the variables
$a
and$c
are used. There was no need to assign$b
.Instead, the list call could have been.