| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 47 | public function compile(string $view): string |
||
| 48 | { |
||
| 49 | $crawler = new Crawler($view); |
||
| 50 | |||
| 51 | foreach($this->registeredComponents as $componentName => $classOrView) { |
||
| 52 | $crawler |
||
| 53 | ->filter($componentName) |
||
| 54 | ->each(function (Crawler $subCrawler) use ($classOrView) { |
||
| 55 | $node = $subCrawler->getNode(0); |
||
| 56 | |||
| 57 | $node->parentNode->replaceChild( |
||
| 58 | $node->ownerDocument->createTextNode("@include({$classOrView})"), // TEMP: @include everything |
||
| 59 | $node |
||
| 60 | ); |
||
| 61 | }); |
||
| 62 | } |
||
| 63 | |||
| 64 | return $crawler->html(); |
||
| 65 | } |
||
| 66 | } |
||
| 67 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: