diff --git a/src/Converters/Converter.php b/src/Converters/Converter.php index d84efb9..451e368 100644 --- a/src/Converters/Converter.php +++ b/src/Converters/Converter.php @@ -20,7 +20,7 @@ public function setTranslationTable($translation_table){ public function convertInput($input) { - $translation_table = $this->translation_table; + $translation_table = $this->translation_table?:[]; $key = array_search(trim($input),$translation_table); if($key !== false){ return $translation_table[$key]; diff --git a/src/FSAPI.php b/src/FSAPI.php index eab57fd..af35fab 100644 --- a/src/FSAPI.php +++ b/src/FSAPI.php @@ -81,8 +81,12 @@ public function doRequest($method, $node = null, $attributes = array(), $delimit if (!$node->validateInput($attributes['value'])) { throw new FSAPIException(sprintf('Validation Failed.', $method)); } - } - return $this->convertResult($this->Request->doRequest($method, $node, $attributes, $delimiter)); + } + try { + return $this->convertResult($this->Request->doRequest($method, $node, $attributes, $delimiter)); + } catch(\Exception $e) { + error_log(sprintf("Exception for %s->%s: %s",$node->getPath(),$method,$e->getMessage())); + } } diff --git a/src/Radio.php b/src/Radio.php index f45d846..4ab812d 100644 --- a/src/Radio.php +++ b/src/Radio.php @@ -150,28 +150,26 @@ public function systemStatus($path = NULL){ $basedir = dirname(__FILE__)."/Nodes/"; $NodesFactory = new NodesFactory(); $all_nodes = $NodesFactory->getAllNodes(); + $result = []; foreach($all_nodes as $file){ $pathinfo = pathinfo($file); include_once($basedir.$file.'.php'); - $node = new $pathinfo['filename']; + $className = "FSAPI\\Nodes\\".$pathinfo['filename']; + $node = new $className(); if(($path !== NULL) && (preg_match("/^$path/",$node->getPath()) !== 1)){ continue; } - if($node->getApiLevel !== $this->api_level){ - continue; - } - - + if($node->getApiLevel() !== $this->api_level){ + continue; + } if(method_exists($node,'getCallMethods')){ $call_methods = $node->getCallMethods(); if(array_search('GET',$call_methods) !== FALSE){ $result[$node->getPath()] = $this->getSet($node); - } } } return $result; - } /** @@ -455,4 +453,4 @@ public function control($value = null){ -} \ No newline at end of file +}