Code Duplication    Length = 4-4 lines in 3 locations

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

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