Beispiel #1
1
 /**
  * Magic __call method overriding to define in runtime the methods should be called based on method invoked.
  * (Something like Ruby metaprogramming :-P). In this way, we decrease the number of methods required
  * (usually should be one method per SOAP or PHP_ZKLib command exposed).
  *
  * Note:
  *
  * Those methods that add, update o delete device information, call SOAP method <b><code>refresh_db()</code></b>
  * to properly update device database.
  *
  * @param string $command command to be invoked.
  * @param array $args commands args.
  * @return string device response in XML format.
  * @throws ConnectionError.
  * @throws UnrecognizedCommand.
  * @throws UnrecognizedArgument.
  */
 public function __call($command, array $args)
 {
     $command_args = count($args) === 0 ? [] : array_shift($args);
     $this->check_for_connection() && $this->check_for_valid_command($command) && $this->check_for_unrecognized_args($command_args);
     if (in_array($command, TADSoap::get_commands_available())) {
         $response = $this->execute_command_via_tad_soap($command, $command_args);
     } else {
         $response = $this->execute_command_via_zklib($command, $command_args);
     }
     $this->check_for_refresh_tad_db($command);
     return $response;
 }