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