1 | <?php |
||
41 | class AliasRecord extends Config |
||
42 | { |
||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | protected $name; |
||
47 | |||
48 | /** |
||
49 | * AliasRecord constructor |
||
50 | * |
||
51 | * @param array|null $data Initial data for alias record |
||
52 | * @param string $name Alias name or site specification for this alias record |
||
53 | * @param string $env Environment for this alias record. Will be appended to |
||
54 | * the alias name, separated by a "." if provided. |
||
55 | * @return type |
||
|
|||
56 | */ |
||
57 | public function __construct(array $data = null, $name = '', $env = '') |
||
65 | |||
66 | /** |
||
67 | * Get a value from the provided config option. Values stored in |
||
68 | * this alias record will override the configuration values, if present. |
||
69 | * |
||
70 | * If multiple alias records need to be chained together in a more |
||
71 | * complex priority arrangement, @see \Consolidation\Config\Config\ConfigOverlay. |
||
72 | * |
||
73 | * @param ConfigInterface $config The configuration object to pull fallback data from |
||
74 | * @param string $key The data item to fetch |
||
75 | * @param mixed $default The default value to return if there is no match |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | public function getConfig(ConfigInterface $config, $key, $default = null) |
||
86 | |||
87 | /** |
||
88 | * Return the name of this alias record. |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | public function name() |
||
96 | |||
97 | /** |
||
98 | * Remember the name of this record |
||
99 | * |
||
100 | * @param string $name |
||
101 | */ |
||
102 | public function setName($name) |
||
106 | |||
107 | /** |
||
108 | * Determine whether this alias has a root. |
||
109 | */ |
||
110 | public function hasRoot() |
||
114 | |||
115 | /** |
||
116 | * Get the root |
||
117 | */ |
||
118 | public function root() |
||
124 | |||
125 | /** |
||
126 | * Get the uri |
||
127 | */ |
||
128 | public function uri() |
||
132 | |||
133 | /** |
||
134 | * Record the uri |
||
135 | * |
||
136 | * @param string $uri |
||
137 | */ |
||
138 | public function setUri($uri) |
||
142 | |||
143 | /** |
||
144 | * Return user@host, or just host if there is no user. Returns |
||
145 | * an empty string if there is no host. |
||
146 | * |
||
147 | * @return string |
||
148 | */ |
||
149 | public function remoteHostWithUser() |
||
157 | |||
158 | /** |
||
159 | * Get the remote user |
||
160 | */ |
||
161 | public function remoteUser() |
||
165 | |||
166 | /** |
||
167 | * Return true if this alias record has a remote user |
||
168 | */ |
||
169 | public function hasRemoteUser() |
||
173 | |||
174 | /** |
||
175 | * Get the remote host |
||
176 | */ |
||
177 | public function remoteHost() |
||
181 | |||
182 | /** |
||
183 | * Return true if this alias record has a remote host that is not |
||
184 | * the local host |
||
185 | */ |
||
186 | public function isRemote() |
||
190 | |||
191 | /** |
||
192 | * Return true if this alias record is for the local system |
||
193 | */ |
||
194 | public function isLocal() |
||
201 | |||
202 | /** |
||
203 | * Determine whether this alias does not represent any site. An |
||
204 | * alias record must either be remote or have a root. |
||
205 | */ |
||
206 | public function isNone() |
||
210 | |||
211 | /** |
||
212 | * Return the 'root' element of this alias if this alias record |
||
213 | * is local. |
||
214 | */ |
||
215 | public function localRoot() |
||
223 | |||
224 | /** |
||
225 | * Export the configuration values in this alias record, and reconfigure |
||
226 | * them so that the layout matches that of the global configuration object. |
||
227 | */ |
||
228 | public function exportConfig() |
||
232 | |||
233 | /** |
||
234 | * Reconfigure data exported from the form it is expected to be in |
||
235 | * inside an alias record to the form it is expected to be in when |
||
236 | * inside a configuration file. |
||
237 | */ |
||
238 | protected function remap($data) |
||
252 | |||
253 | /** |
||
254 | * Fetch the parameter-specific options from the 'alias-parameters' section of the alias. |
||
255 | * @param string $parameterName |
||
256 | * @return array |
||
257 | */ |
||
258 | protected function getParameterSpecificOptions($aliasData, $parameterName) |
||
265 | |||
266 | /** |
||
267 | * Convert the data in this record to the layout that was used |
||
268 | * in the legacy code, for backwards compatiblity. |
||
269 | */ |
||
270 | public function legacyRecord() |
||
283 | |||
284 | /** |
||
285 | * Conversion table from old to new option names. These all implicitly |
||
286 | * go in `options`, although they can come from different locations. |
||
287 | */ |
||
288 | protected function remapOptionTable() |
||
297 | } |
||
298 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.