Code Duplication    Length = 14-14 lines in 2 locations

src/Paraunit/Parser/JSON/LogPrinter.php 1 location

@@ 283-296 (lines=14) @@
280
         * @throws \RuntimeException
281
         * @throws \InvalidArgumentException
282
         */
283
        private function getLogFilename(): string
284
        {
285
            $logDir = $this->getLogDirectory();
286
            if (! @mkdir($logDir, 0777, true) && ! is_dir($logDir)) {
287
                throw new \RuntimeException('Cannot create folder for JSON logs');
288
            }
289
    
290
            $logFilename = getenv(EnvVariables::PROCESS_UNIQUE_ID);
291
            if ($logFilename === false) {
292
                throw new \InvalidArgumentException('Log filename not received: environment variable not set');
293
            }
294
    
295
            return $logDir . $logFilename . '.json.log';
296
        }
297
    
298
        /**
299
         * @return string

src/Paraunit/Parser/JSON/LogPrinterV6.php 1 location

@@ 276-289 (lines=14) @@
273
     * @throws \RuntimeException
274
     * @throws \InvalidArgumentException
275
     */
276
    private function getLogFilename(): string
277
    {
278
        $logDir = $this->getLogDirectory();
279
        if (! @mkdir($logDir, 0777, true) && ! is_dir($logDir)) {
280
            throw new \RuntimeException('Cannot create folder for JSON logs');
281
        }
282
283
        $logFilename = getenv(EnvVariables::PROCESS_UNIQUE_ID);
284
        if ($logFilename === false) {
285
            throw new \InvalidArgumentException('Log filename not received: environment variable not set');
286
        }
287
288
        return $logDir . $logFilename . '.json.log';
289
    }
290
291
    /**
292
     * @return string