-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathResourceInterface.php
More file actions
138 lines (119 loc) · 3.58 KB
/
Copy pathResourceInterface.php
File metadata and controls
138 lines (119 loc) · 3.58 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?php
declare(strict_types=1);
/*
* UserFrosting Framework (http://www.userfrosting.com)
*
* @link https://github.com/userfrosting/framework
* @copyright Copyright (c) 2013-2024 Alexander Weissman, Louis Charette, Jordan Mele
* @license https://github.com/userfrosting/framework/blob/master/LICENSE.md (MIT License)
*/
namespace UserFrosting\UniformResourceLocator;
use Stringable;
/**
* The representation of a resource.
*/
interface ResourceInterface extends Stringable
{
/**
* Get Resource URI.
*
* @return string
*/
public function getUri(): string;
/**
* Get Resource directory URI.
* Represents the directory path of the resource, indicating
* where it is located. Applies whether the resource is a file
* or a directory.
*
* @return string
*/
public function getDirUri(): string;
/**
* Get the resource base path, aka the path that comes after the `://`.
*
* @return string
*/
public function getBasePath(): string;
/**
* Extract the resource filename (e.g. /location/stream/foo/test.txt -> test).
* If resource is a directory, return empty string.
*
* @return string
*/
public function getFilename(): string;
/**
* Extract the trailing name component (e.g. /location/stream/foo/test.txt -> test.txt).
* If resource is a directory, return empty string.
*
* @return string
*/
public function getBasename(): string;
/**
* Extract the resource extension (e.g. /location/stream/test.txt -> txt).
* If resource is a directory, return empty string.
*
* @return string
*/
public function getExtension(): string;
/**
* Extract the resource dirname, relative to the locator
* base path. This returns the path where the resource is
* located, whether it is a file or a directory.
* e.g. `/var/www/site/location/stream/foo/test.txt' -> `/location/stream/foo`
* e.g. `/var/www/site/location/stream/foo/bar' -> `/location/stream/foo`.
*
* @return string
*/
public function getRelativeDirname(): string;
/**
* Extract the absolute directory path of the resource.
* Returns the path where the resource is located, whether
* it is a file or a directory.
* e.g. `/var/www/site/location/stream/foo/test.txt' -> `/var/www/site/location/stream/foo`.
*
* @return string
*/
public function getAbsoluteDirname(): string;
/**
* Extract the resource dirname, relative to the stream URI.
* Returns the path where the resource is located, whether it
* is a file or a directory.
* e.g. `/location/stream/foo/test.txt' -> `foo`.
*
* @return string
*/
public function getDirname(): string;
/**
* Check if the resource is a directory.
*
* @return bool
*/
public function isDir(): bool;
/**
* @return ResourceLocationInterface|null
*/
public function getLocation(): ?ResourceLocationInterface;
/**
* Return the absolute path to the resource on the filesystem.
*
* @return string
*/
public function getAbsolutePath(): string;
/**
* Resource path, relative to the locator base path, and containing the stream and location path.
*
* @return string
*/
public function getPath(): string;
/**
* Locator base Path.
*
* @return string
*/
public function getLocatorBasePath(): string;
/**
* @return ResourceStreamInterface
*/
public function getStream(): ResourceStreamInterface;
}