public function mkdir(string $dir, array $options = []): SystemService
    {
        $options = array_replace(
            [
                'mode'          => 0777,
                'recursive'     => true,
                'context'       => null
            ],
            $options
        );

        if (file_exists($dir)) {
            if (!is_dir($dir)) {
                throw NotADirectoryException::create(
                    'Can\'t create directory "'.$dir.'" because it exists and it\'s not a directory.'
                );
            }

            return $this;
        }

        $args = [
            $dir,
            $options['mode'],
            $options['recursive']
        ];

        if ($options['context'] !== null) {
            $args[] = $options['context'];
        }

        if (!@mkdir(...$args)) {
            $lastError = $this->getLastPhpError();

            throw IOException::create(
                'Couldn\'t create directory "'.$dir.'". PHP Error: '.print_r($lastError, true)
            );
        }

        return $this;
    }