1 | <?php |
||
35 | class PropertiesUtil |
||
36 | { |
||
37 | |||
38 | /** |
||
39 | * The singleton instance. |
||
40 | * |
||
41 | * @var \AppserverIo\Properties\PropertiesUtil |
||
42 | */ |
||
43 | protected static $instance; |
||
44 | |||
45 | /** |
||
46 | * This is a utility class, so protect it against direct |
||
47 | * instantiation. |
||
48 | */ |
||
49 | 1 | private function __construct() |
|
52 | |||
53 | /** |
||
54 | * This is a utility class, so protect it against cloning. |
||
55 | * |
||
56 | * @return void |
||
57 | */ |
||
58 | private function __clone() |
||
61 | |||
62 | /** |
||
63 | * Return's the singleton instance and creates a new one if necessary. |
||
64 | * |
||
65 | * @return \AppserverIo\Properties\PropertiesUtil The singleton instance |
||
66 | */ |
||
67 | 2 | public static function singleton() |
|
78 | |||
79 | /** |
||
80 | * Replaces the variables declared in the properties with the |
||
81 | * properties value itself. |
||
82 | * |
||
83 | * @param \AppserverIo\Properties\PropertiesInterface $properties The properties with the variables/values to replace |
||
84 | * @param string $pattern The pattern that declares the variables (in valid sprintf format) |
||
85 | * |
||
86 | * @return void |
||
87 | */ |
||
88 | 1 | public function replaceProperties(PropertiesInterface $properties, $pattern = PropertyStreamFilterParams::PATTERN) |
|
|
|||
89 | { |
||
90 | 1 | foreach ($properties as $key => $value) { |
|
91 | 1 | $properties->setProperty($key, $this->replacePropertiesInString($properties, $value)); |
|
92 | 1 | } |
|
93 | 1 | } |
|
94 | |||
95 | /** |
||
96 | * Replaces the variables declared by the passed token with the |
||
97 | * properties and returns the content. |
||
98 | * |
||
99 | * @param \AppserverIo\Properties\PropertiesInterface $properties The properties with the values to replace |
||
100 | * @param string $string The string to replace the variables with the properties |
||
101 | * @param string $pattern The pattern that declares the variables (in valid sprintf format) |
||
102 | * |
||
103 | * @return string The content of the file with the replaced variables |
||
104 | */ |
||
105 | 2 | public function replacePropertiesInString(PropertiesInterface $properties, $string, $pattern = PropertyStreamFilterParams::PATTERN) |
|
122 | |||
123 | /** |
||
124 | * Replaces the variables declared by the passed token with the |
||
125 | * properties and returns the content. |
||
126 | * |
||
127 | * @param \AppserverIo\Properties\PropertiesInterface $properties The properties with the values to replace |
||
128 | * @param resource $fp The file pointer to replace the variables with the properties |
||
129 | * @param string $pattern The pattern that declares the variables (in valid sprintf format) |
||
130 | * |
||
131 | * @return string The content of the file with the replaced variables |
||
132 | */ |
||
133 | 2 | public function replacePropertiesInStream(PropertiesInterface $properties, $fp, $pattern = PropertyStreamFilterParams::PATTERN) |
|
146 | } |
||
147 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.