-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bundle.hh
100 lines (87 loc) · 2.42 KB
/
Bundle.hh
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
<?hh // strict
/**
* @copyright 2010-2015, The Titon Project
* @license http://opensource.org/licenses/bsd-license.php
* @link http://titon.io
*/
namespace Titon\Io;
/**
* Interface for the resource bundles library.
*
* @package Titon\Io
*/
interface Bundle {
/**
* Add a resource path to use during the lookup cycle.
*
* @param string $domain
* @param string $path
* @return $this
*/
public function addPath(string $domain, string $path): this;
/**
* Add multiple resource paths.
*
* @param string $domain
* @param \Titon\Io\PathList $paths
* @return $this
*/
public function addPaths(string $domain, PathList $paths): this;
/**
* Add a file reader to use for resource parsing.
*
* @param \Titon\Io\Reader $reader
* @return $this
*/
public function addReader(Reader $reader): this;
/**
* Add multiple file readers.
*
* @param \Titon\Io\ReaderList $readers
* @return $this
*/
public function addReaders(ReaderList $readers): this;
/**
* Return a list of all files within a specific domain.
*
* @param string $domain
* @return \Titon\Io\PathList
*/
public function getContents(string $domain): PathList;
/**
* Return a list of all domain keys.
*
* @return \Titon\Io\DomainList
*/
public function getDomains(): DomainList;
/**
* Return all resource paths for a single domain.
*
* @param string $domain
* @return \Titon\Io\PathList
*/
public function getDomainPaths(string $domain): PathList;
/**
* Return all resource paths for all domains.
*
* @return \Titon\Io\DomainPathMap
*/
public function getPaths(): DomainPathMap;
/**
* Return all loaded Readers.
*
* @return \Titon\Io\ReaderMap
*/
public function getReaders(): ReaderMap;
/**
* Parse the contents of every file that matches the resource name.
* Begin by looping through all resource locations and all Readers.
* If a resource is found that matches the name and a loaded Reader extension,
* parse the file and merge its contents with the previous resource of the same name.
*
* @param string $domain
* @param string $resource
* @return \Titon\Io\ResourceMap
*/
public function loadResource(string $domain, string $resource): ResourceMap;
}