Exemplo n.º 1
0
 /**
  * Renvoie un objet du type précisé dans le champ msgType de $source
  * @param \StdClass $source
  * @param Connexion $connexion
  * @return Action
  */
 public static function make(\StdClass $source, Connexion $connexion)
 {
     $class = __NAMESPACE__ . '\\' . ucfirst($source->type);
     if (in_array(ucfirst($source->type), Serveur::getInstance()->getActions())) {
         $ret = new $class($source);
     } else {
         $ret = new Unknown($source);
     }
     /** @var Action $ret */
     $ret->setConnexion($connexion);
     $ret->setResponse(array('idConnection' => $connexion->getRessourceId(), 'msgType' => $source->type, 'error' => 0, 'errorMsg' => ''));
     return $ret;
 }
Exemplo n.º 2
0
 public function decorate(Unknown $obj)
 {
     // plus 1 edge cause typing is bad
     // therefore the fallback links with methods of same name.
     return $obj->getTitle();
 }