-
Notifications
You must be signed in to change notification settings - Fork 0
/
P.php
85 lines (69 loc) · 1.42 KB
/
P.php
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/**
* PhpPath
* @link https://github.com/masicek/PhpPath
* @author Viktor Mašíček <[email protected]>
* @license "New" BSD License
*/
namespace PhpPath;
require_once __DIR__ . '/Path.php';
use PhpPath\Path;
/**
* Short variant for class Path
*
* @author Viktor Mašíček <[email protected]>
*/
class P
{
/**
* Check if the directory exists
*
* @param string $path Checked path
*
* @throws Exception Directory not exists
* @return string Input path
*/
static public function cd($path)
{
return Path::checkDirectory($path);
}
/**
* Check if the file exists
*
* @param string $path Checked path
*
* @throws Exception File not exists
* @return string Input path
*/
static public function cf($path)
{
return Path::checkFile($path);
}
/**
* Make path from list of arguments.
*
* @return string
*/
static public function m()
{
return call_user_func_array(__NAMESPACE__ . '\Path::make', func_get_args());
}
/**
* Make path from list of arguments and check if the directory exists
*
* @return string
*/
static public function mcd()
{
return call_user_func_array(__NAMESPACE__ . '\Path::makeAndCheckDirectory', func_get_args());
}
/**
* Make path from list of arguments and check if the file exists
*
* @return string
*/
static public function mcf()
{
return call_user_func_array(__NAMESPACE__ . '\Path::makeAndCheckFile', func_get_args());
}
}