Ejemplo n.º 1
0
 public function __construct($request, $origin)
 {
     parent::__construct($request);
     // Abstracted out for example
     $APIKey = new APIKey();
     $User = new User($this->verb);
     if (!array_key_exists('apiKey', $this->request)) {
         throw new Exception('No API Key provided');
     } else {
         if (!$APIKey->verifyKey($this->request['apiKey'], $origin)) {
             throw new Exception('Invalid API Key');
         } else {
             if (array_key_exists('token', $this->request) && !$User->get('token', $this->request['token'])) {
                 throw new Exception('Invalid User Token');
             }
         }
     }
     $this->User = $User;
     $this->obj_db = new PichannelDatabase();
     $this->s_host_domain = $this->obj_db->getDomainName();
 }