d56c082a618162263d4ca10a1e6de84a7747f147
[yaffs-website] / vendor / consolidation / site-alias / src / AliasRecordInterface.php
1 <?php
2 namespace Consolidation\SiteAlias;
3
4 use Consolidation\Config\Config;
5 use Consolidation\Config\ConfigInterface;
6 use Consolidation\Config\Util\ArrayUtil;
7
8 /**
9  * An alias record is a configuration record containing well-known items.
10  *
11  * NOTE: AliasRecord is implemented as a Config subclass; however, it
12  * should not be used as a config. (A better implementation would be
13  * "hasa" config, but that is less convenient, as we want all of the
14  * same capabilities as a config object).
15  *
16  * If using an alias record as config is desired, use the 'exportConfig()'
17  * method.
18  *
19  * Example remote alias:
20  *
21  * ---
22  * host: www.myisp.org
23  * user: www-data
24  * root: /path/to/drupal
25  * uri: mysite.org
26  *
27  * Example local alias with global and command-specific options:
28  *
29  * ---
30  * root: /path/to/drupal
31  * uri: mysite.org
32  * options:
33  *   no-interaction: true
34  * command:
35  *   user:
36  *     login:
37  *       options:
38  *         name: superuser
39  */
40 interface AliasRecordInterface extends ConfigInterface
41 {
42     /**
43      * Get a value from the provided config option. Values stored in
44      * this alias record will override the configuration values, if present.
45      *
46      * If multiple alias records need to be chained together in a more
47      * complex priority arrangement, @see \Consolidation\Config\Config\ConfigOverlay.
48      *
49      * @param ConfigInterface $config The configuration object to pull fallback data from
50      * @param string $key The data item to fetch
51      * @param mixed $default The default value to return if there is no match
52      *
53      * @return string
54      */
55     public function getConfig(ConfigInterface $config, $key, $default = null);
56
57     /**
58      * Return the name of this alias record.
59      *
60      * @return string
61      */
62     public function name();
63
64     /**
65      * Remember the name of this record
66      *
67      * @param string $name
68      */
69     public function setName($name);
70
71     /**
72      * Determine whether this alias has a root.
73      */
74     public function hasRoot();
75
76     /**
77      * Get the root
78      */
79     public function root();
80
81     /**
82      * Get the uri
83      */
84     public function uri();
85
86     /**
87      * Record the uri
88      *
89      * @param string $uri
90      */
91     public function setUri($uri);
92
93     /**
94      * Return user@host, or just host if there is no user. Returns
95      * an empty string if there is no host.
96      *
97      * @return string
98      */
99     public function remoteHostWithUser();
100
101     /**
102      * Get the remote user
103      */
104     public function remoteUser();
105
106     /**
107      * Return true if this alias record has a remote user
108      */
109     public function hasRemoteUser();
110
111     /**
112      * Get the remote host
113      */
114     public function remoteHost();
115
116     /**
117      * Return true if this alias record has a remote host that is not
118      * the local host
119      */
120     public function isRemote();
121
122     /**
123      * Return true if this alias record is for the local system
124      */
125     public function isLocal();
126
127     /**
128      * Determine whether this alias does not represent any site. An
129      * alias record must either be remote or have a root.
130      */
131     public function isNone();
132
133     /**
134      * Return the 'root' element of this alias if this alias record
135      * is local.
136      */
137     public function localRoot();
138
139     /**
140      * Export the configuration values in this alias record, and reconfigure
141      * them so that the layout matches that of the global configuration object.
142      */
143     public function exportConfig();
144 }