| @@ 58-69 (lines=12) @@ | ||
| 55 | /** |
|
| 56 | * {@inheritdoc} |
|
| 57 | */ |
|
| 58 | public function getAssortmentDependencies($namespace, $bodyContent) |
|
| 59 | { |
|
| 60 | // To see what this regex should match and what shouldn't be see: |
|
| 61 | // tests/allejo/stakx/Test/FrontMatter/FrontMatterDocumentTest.php |
|
| 62 | ||
| 63 | $regex = "/{[{%].*?(?:$namespace)(?:\.|\[['\"])?([^_][^\W]+)?(?:\.|['\"]\])?[^_=]*?[%}]}/"; |
|
| 64 | $results = array(); |
|
| 65 | ||
| 66 | preg_match_all($regex, $bodyContent, $results); |
|
| 67 | ||
| 68 | return array_unique($results[1]); |
|
| 69 | } |
|
| 70 | ||
| 71 | /** |
|
| 72 | * {@inheritdoc} |
|
| @@ 74-87 (lines=14) @@ | ||
| 71 | /** |
|
| 72 | * {@inheritdoc} |
|
| 73 | */ |
|
| 74 | public function getTemplateImportDependencies($bodyContent) |
|
| 75 | { |
|
| 76 | $regex = "/{%\s?(?:import|from|include)\s?['\"](.+)['\"].+/"; |
|
| 77 | $results = array(); |
|
| 78 | ||
| 79 | preg_match_all($regex, $bodyContent, $results); |
|
| 80 | ||
| 81 | if (empty($results[1])) |
|
| 82 | { |
|
| 83 | return []; |
|
| 84 | } |
|
| 85 | ||
| 86 | return array_unique($results[1]); |
|
| 87 | } |
|
| 88 | ||
| 89 | /** |
|
| 90 | * {@inheritdoc} |
|