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

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