Code Duplication    Length = 17-20 lines in 2 locations

src/Listeners/Renderer/Debug/ConfigurationFileRenderer.php 1 location

@@ 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.

src/Utils/DebugUtil.php 1 location

@@ 209-228 (lines=20) @@
206
     * @return void
207
     * @throws \Exception Is thrown, if the configuration can not be dumped
208
     */
209
    public function prepareDump(string $serial) : void
210
    {
211
212
        // load the actual status
213
        $status = $this->getRegistryProcessor()->getAttribute(RegistryKeys::STATUS);
214
215
        // clear the filecache
216
        clearstatcache();
217
218
        // query whether or not the configured source directory is available
219
        if (!is_dir($sourceDir = $status[RegistryKeys::SOURCE_DIRECTORY])) {
220
            throw new \Exception(sprintf('Configured source directory %s is not available!', $sourceDir));
221
        }
222
223
        // render the debug artefacts
224
        $this->getRenderer()->render($serial);
225
226
        // log a message that the debug artefacts has successfully been rendered
227
        $this->getSystemLogger()->info(sprintf('Successfully rendered the debug artefacts for serial "%s"', $serial));
228
    }
229
230
    /**
231
     * The method to create the debug dump with all artefacts and reports.