protected static function createDirectory($dir) { $perm = 0755; if (!is_dir($dir) && !mkdir($dir, $perm, true)) { $msg = 'Unable to create directory "%1$s" with permission "%2$s"'; throw new \RuntimeException(sprintf($msg, $dir, $perm)); } }