Code Duplication    Length = 4-4 lines in 3 locations

src/SilverStripe/BehatExtension/Context/BasicContext.php 3 locations

@@ 304-307 (lines=4) @@
301
        \Filesystem::makeFolder($path);
302
        $path = realpath($path);
303
304
        if (!file_exists($path)) {
305
            file_put_contents('php://stderr', sprintf('"%s" is not valid directory and failed to create it' . PHP_EOL, $path));
306
            return;
307
        }
308
309
        if (file_exists($path) && !is_dir($path)) {
310
            file_put_contents('php://stderr', sprintf('"%s" is not valid directory' . PHP_EOL, $path));
@@ 309-312 (lines=4) @@
306
            return;
307
        }
308
309
        if (file_exists($path) && !is_dir($path)) {
310
            file_put_contents('php://stderr', sprintf('"%s" is not valid directory' . PHP_EOL, $path));
311
            return;
312
        }
313
        if (file_exists($path) && !is_writable($path)) {
314
            file_put_contents('php://stderr', sprintf('"%s" directory is not writable' . PHP_EOL, $path));
315
            return;
@@ 313-316 (lines=4) @@
310
            file_put_contents('php://stderr', sprintf('"%s" is not valid directory' . PHP_EOL, $path));
311
            return;
312
        }
313
        if (file_exists($path) && !is_writable($path)) {
314
            file_put_contents('php://stderr', sprintf('"%s" directory is not writable' . PHP_EOL, $path));
315
            return;
316
        }
317
318
        $path = sprintf('%s/%s_%d.png', $path, basename($feature->getFile()), $step->getLine());
319
        $screenshot = $driver->getWebDriverSession()->screenshot();