| @@ 45-61 (lines=17) @@ | ||
| 42 | * |
|
| 43 | * @return void |
|
| 44 | */ |
|
| 45 | public function render(string $serial = null) |
|
| 46 | { |
|
| 47 | ||
| 48 | // load the actual status |
|
| 49 | $status = $this->getRegistryProcessor()->getAttribute(RegistryKeys::STATUS); |
|
| 50 | ||
| 51 | // clear the filecache |
|
| 52 | clearstatcache(); |
|
| 53 | ||
| 54 | // query whether or not the configured source directory is available |
|
| 55 | if (!is_dir($sourceDir = $status[RegistryKeys::SOURCE_DIRECTORY])) { |
|
| 56 | throw new \Exception(sprintf('Configured source directory %s is not available!', $sourceDir)); |
|
| 57 | } |
|
| 58 | ||
| 59 | // finally write the serialized configuration file to the source directory |
|
| 60 | $this->write($this->dump($this->getConfiguration()), sprintf('%s/debug-configuration.json', $sourceDir)); |
|
| 61 | } |
|
| 62 | ||
| 63 | /** |
|
| 64 | * Returns a string representation of the actual configuration instance. |
|
| @@ 199-218 (lines=20) @@ | ||
| 196 | * @return void |
|
| 197 | * @throws \Exception Is thrown, if the configuration can not be dumped |
|
| 198 | */ |
|
| 199 | public function prepareDump(string $serial) : void |
|
| 200 | { |
|
| 201 | ||
| 202 | // load the actual status |
|
| 203 | $status = $this->getRegistryProcessor()->getAttribute(RegistryKeys::STATUS); |
|
| 204 | ||
| 205 | // clear the filecache |
|
| 206 | clearstatcache(); |
|
| 207 | ||
| 208 | // query whether or not the configured source directory is available |
|
| 209 | if (!is_dir($sourceDir = $status[RegistryKeys::SOURCE_DIRECTORY])) { |
|
| 210 | throw new \Exception(sprintf('Configured source directory %s is not available!', $sourceDir)); |
|
| 211 | } |
|
| 212 | ||
| 213 | // render the debug artefacts |
|
| 214 | $this->getRenderer()->render($serial); |
|
| 215 | ||
| 216 | // log a message that the debug artefacts has successfully been rendered |
|
| 217 | $this->getSystemLogger()->info(sprintf('Successfully rendered the debug artefacts for serial "%s"', $serial)); |
|
| 218 | } |
|
| 219 | ||
| 220 | /** |
|
| 221 | * The method to create the debug dump with all artefacts and reports. |
|