Example #1
0
 /**
  * @return array
  */
 public final function toArray()
 {
     $Data = [];
     foreach (array_keys($this->Values) as $name) {
         $Data[$name] = call_user_func_array([$this, 'get' . Src::tocm($name, '-', '_')], []);
     }
     return $Data;
 }
Example #2
0
 /**
  * @return string
  */
 public function getKey()
 {
     return is_null($this->key) ? Src::frcm(preg_replace('/^.*\\\\/', null, get_class($this))) : $this->key;
 }
Example #3
0
 /**
  * @param string $name
  * @param array $Args
  * @return Client|string
  * @throws \Exception
  */
 public function __call($name, array $Args = [])
 {
     if (is_null($this->namespace)) {
         $this->namespace = Src::frcm($name, '-');
         return $this;
     }
     try {
         $Bridge = (new Bridge($this->url, Bridge::RM_POST))->withToken($this->token)->withMethod($name)->withNamespace($this->namespace)->withParams($Args);
         if (count($this->Watchers) > 0) {
             foreach ($this->Watchers as $Watcher) {
                 $Bridge->with($Watcher->getKey(), $Watcher->watch());
             }
         }
         return !is_null($this->Wrapper) ? $this->Wrapper->call($this, $Bridge->send()) : $Bridge->send();
     } finally {
         $this->namespace = null;
     }
 }