-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFilesystem.php
More file actions
63 lines (55 loc) · 1.13 KB
/
Filesystem.php
File metadata and controls
63 lines (55 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/*
* This file is part of the Niga PHP framework package
*
* (c) Abass Dev <abass@abassdev.com>
*/
namespace Niga\Framework\Filesystem;
use Niga\Filesystem\Exceptions\FileNotFoundException;
use Niga\Filesystem\Exceptions\DirNotFoundException;
/**
* Filesystem
*
* @author Abass Dev <abass@abassdev.com>
*/
class Filesystem
{
/**
* Default app root
*
* @var string $ROOT
*/
public static $ROOT;
/**
* Constructor
*
* @param string $root
*/
public function __construct($root)
{
self::$ROOT = $root;
}
/**
* @var string $fieName
*/
private string $fieName;
public function isFile(string $fieName): bool
{
if (!file_exists($fieName)) {
throw new FileNotFoundException("Fatal error: {$fieName} file not found");
}
return true;
}
/**
* @param string $dirName
*
* @return bool
*/
public function isDir($dirName)
{
if (!is_dir($dirName)) {
throw new DirNotFoundException("Fatal error: {$dirName} directory not found");
}
return true;
}
}