-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlatformInterface.php
92 lines (80 loc) · 3.13 KB
/
PlatformInterface.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
86
87
88
89
90
91
92
<?php declare(strict_types=1);
namespace Xdg\BaseDirectory;
interface PlatformInterface
{
/**
* Returns the base directory relative to which user-specific data files should be stored.
*/
public function getDataHome(): string;
/**
* Returns the base directory relative to which user-specific configuration files should be stored.
*/
public function getConfigHome(): string;
/**
* Returns the base directory relative to which user-specific non-essential (cached) data should be written.
*/
public function getCacheHome(): string;
/**
* Returns the base directory relative to which user-specific state files should be stored.
*/
public function getStateHome(): string;
/**
* Returns the base directory relative to which user-specific non-essential runtime files
* and other file objects (such as sockets, named pipes, ...) should be stored.
*/
public function getRuntimeDirectory(): string;
/**
* Returns the preference-ordered set of base directories to search for data files
* in addition to the base directory return by {@see self::getDataHome()}.
*
* @return string[]
*/
public function getDataDirectories(): array;
/**
* Returns the preference-ordered set of base directories to search for config files
* in addition to the base directory return by {@see self::getConfigHome()}.
*
* @return string[]
*/
public function getConfigDirectories(): array;
/**
* Iterates XDG config paths in most user-specific order,
* and returns the first one matching the given predicate.
* If no predicate is given, returns the first config path.
* Paths are iterated from most to least user-specific.
*
* @param string $subPath
* @param null|callable(string): bool $predicate
* @return string|null
*/
public function findConfigPath(string $subPath = '', ?callable $predicate = null): ?string;
/**
* Iterates XDG data paths in most user-specific order,
* and returns the first one matching the given predicate.
* If no predicate is given, returns the first data path.
* Paths are iterated from most to least user-specific
*
* @param string $subPath
* @param null|callable(string $path): bool $predicate
* @return string|null
*/
public function findDataPath(string $subPath = '', ?callable $predicate = null): ?string;
/**
* Returns the list of XDG config paths, in least to most user-specific order,
* optionally filtered by the given predicate.
*
* @param string $subPath
* @param null|callable(string): bool $predicate
* @return string[]
*/
public function collectConfigPaths(string $subPath = '', ?callable $predicate = null): array;
/**
* Returns the list of XDG data paths, in least to most user-specific order.
* optionally filtered by the given predicate.
*
* @param string $subPath
* @param null|callable(string): bool $predicate
* @return string[]
*/
public function collectDataPaths(string $subPath = '', ?callable $predicate = null): array;
}