Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php declare(strict_types=1);
2
/*
3
 * This file is part of phpunit/php-code-coverage.
4
 *
5
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace SebastianBergmann\CodeCoverage\Util;
11
 
12
use function is_dir;
13
use function mkdir;
14
use function sprintf;
15
 
16
/**
17
 * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage
18
 */
19
final class Filesystem
20
{
21
    /**
22
     * @throws DirectoryCouldNotBeCreatedException
23
     */
24
    public static function createDirectory(string $directory): void
25
    {
26
        $success = !(!is_dir($directory) && !@mkdir($directory, 0777, true) && !is_dir($directory));
27
 
28
        if (!$success) {
29
            throw new DirectoryCouldNotBeCreatedException(
30
                sprintf(
31
                    'Directory "%s" could not be created',
32
                    $directory
33
                )
34
            );
35
        }
36
    }
37
}