| @@ 166-191 (lines=26) @@ | ||
| 163 | * |
|
| 164 | * @return string |
|
| 165 | */ |
|
| 166 | protected function processSource(string $source, string $path): string |
|
| 167 | { |
|
| 168 | foreach ($this->processors as $processor) { |
|
| 169 | /** |
|
| 170 | * @var ProcessorInterface |
|
| 171 | */ |
|
| 172 | if (!is_object($processor)) { |
|
| 173 | $processor = $this->container->make($processor); |
|
| 174 | } |
|
| 175 | ||
| 176 | $benchmark = $this->benchmark('process', get_class($processor) . '-{' . $path); |
|
| 177 | try { |
|
| 178 | //Post processing |
|
| 179 | $source = $processor->modify( |
|
| 180 | $this->environment, |
|
| 181 | $source, |
|
| 182 | $this->loader->fetchNamespace($path), |
|
| 183 | $this->loader->fetchName($path) |
|
| 184 | ); |
|
| 185 | } finally { |
|
| 186 | $this->benchmark($benchmark); |
|
| 187 | } |
|
| 188 | } |
|
| 189 | ||
| 190 | return $source; |
|
| 191 | } |
|
| 192 | ||
| 193 | /** |
|
| 194 | * In most of cases stempler will get view processors to be executed before composing, to run |
|
| @@ 59-78 (lines=20) @@ | ||
| 56 | /** |
|
| 57 | * {@inheritdoc} |
|
| 58 | */ |
|
| 59 | public function getSource($path) |
|
| 60 | { |
|
| 61 | $source = $this->loader->getSource($path); |
|
| 62 | ||
| 63 | foreach ($this->processors as $processor) { |
|
| 64 | $benchmark = $this->benchmark('process', $path . '@' . get_class($processor)); |
|
| 65 | try { |
|
| 66 | $source = $processor->modify( |
|
| 67 | $this->environment, |
|
| 68 | $source, |
|
| 69 | $this->fetchNamespace($path), |
|
| 70 | $this->fetchName($path) |
|
| 71 | ); |
|
| 72 | } finally { |
|
| 73 | $this->benchmark($benchmark); |
|
| 74 | } |
|
| 75 | } |
|
| 76 | ||
| 77 | return $source; |
|
| 78 | } |
|
| 79 | ||
| 80 | /** |
|
| 81 | * {@inheritdoc} |
|