PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 3.0.1
Defender Security – Malware Scanner, Login Security & Firewall v3.0.1
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / vendor / php-di / php-di / src / DI / Definition / Helper / EnvironmentVariableDefinitionHelper.php

EnvironmentVariableDefinitionHelper.php in Defender Security – Malware Scanner, Login Security & Firewall 3.0.1, at vendor/php-di/php-di/src/DI/Definition/Helper/EnvironmentVariableDefinitionHelper.php

58 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace DI\Definition\Helper;
4
5 use DI\Definition\EnvironmentVariableDefinition;
6
7 /**
8 * Helps defining how to create an instance of an environment variable definition.
9 *
10 * @author James Harris <[email protected]>
11 */
12 class EnvironmentVariableDefinitionHelper implements DefinitionHelper
13 {
14 /**
15 * The name of the environment variable.
16 * @var string
17 */
18 private $variableName;
19
20 /**
21 * Whether or not the environment variable definition is optional.
22 *
23 * If true and the environment variable given by $variableName has not been
24 * defined, $defaultValue is used.
25 *
26 * @var bool
27 */
28 private $isOptional;
29
30 /**
31 * The default value to use if the environment variable is optional and not provided.
32 * @var mixed
33 */
34 private $defaultValue;
35
36 /**
37 * @param string $variableName The name of the environment variable
38 * @param bool $isOptional Whether or not the environment variable definition is optional
39 * @param mixed $defaultValue The default value to use if the environment variable is optional and not provided
40 */
41 public function __construct($variableName, $isOptional, $defaultValue = null)
42 {
43 $this->variableName = $variableName;
44 $this->isOptional = $isOptional;
45 $this->defaultValue = $defaultValue;
46 }
47
48 /**
49 * @param string $entryName Container entry name
50 *
51 * @return EnvironmentVariableDefinition
52 */
53 public function getDefinition($entryName)
54 {
55 return new EnvironmentVariableDefinition($entryName, $this->variableName, $this->isOptional, $this->defaultValue);
56 }
57 }
58