@@ 96-107 (lines=12) @@ | ||
93 | * @return \RouterOS\Config |
|
94 | * @throws \RouterOS\Exceptions\ConfigException |
|
95 | */ |
|
96 | public function delete(string $name): Config |
|
97 | { |
|
98 | // Check of key in array |
|
99 | if (ArrayHelper::checkIfKeyNotExist($name, self::ALLOWED)) { |
|
100 | throw new ConfigException("Requested parameter '$name' not found in list [" . implode(',', array_keys(self::ALLOWED)) . ']'); |
|
101 | } |
|
102 | ||
103 | // Save value to array |
|
104 | unset($this->_parameters[$name]); |
|
105 | ||
106 | return $this; |
|
107 | } |
|
108 | ||
109 | /** |
|
110 | * Return parameter of current config by name |
|
@@ 116-124 (lines=9) @@ | ||
113 | * @return mixed |
|
114 | * @throws ConfigException |
|
115 | */ |
|
116 | public function get(string $name) |
|
117 | { |
|
118 | // Check of key in array |
|
119 | if (ArrayHelper::checkIfKeyNotExist($name, self::ALLOWED)) { |
|
120 | throw new ConfigException("Requested parameter '$name' not found in list [" . implode(',', array_keys(self::ALLOWED)) . ']'); |
|
121 | } |
|
122 | ||
123 | return $this->getPort($name) ?? $this->_parameters[$name]; |
|
124 | } |
|
125 | ||
126 | /** |
|
127 | * Return array with all parameters of configuration |