Example #1
0
 /**
  * Call magic method to allow any request method/verb
  * 
  * @param  string                               $method Method/Verb of the request
  * @param  array                                $args   Array with all the arguments
  * @return Ponticlaro\Bebop\HttpClient\Response         Response object
  */
 public function __call($method, $args)
 {
     // Define URL
     $url = isset($args[0]) && is_string($args[0]) ? $this->__url . '/' . $args[0] : $this->__url;
     // Get current call configuration array
     $call_config = isset($args[1]) ? $args[1] : array();
     // Get current call headers
     $call_headers = isset($call_config['headers']) && is_array($call_config['headers']) ? $call_config['headers'] : array();
     // Get current call cookies
     $call_cookies = isset($call_config['cookies']) && is_array($call_config['cookies']) ? $call_config['cookies'] : array();
     // Unset headers and cookies before mixing with config collection
     if (isset($call_config['headers'])) {
         unset($call_config['headers']);
     }
     if (isset($call_config['cookies'])) {
         unset($call_config['cookies']);
     }
     // Mix with cached configuration
     $this->__config->set($call_config);
     $this->__headers->set($call_headers);
     $this->__cookies->set($call_cookies);
     // Build final request configuration
     $config = $this->__config->getAll();
     $config['headers'] = $this->__headers->getAll();
     $config['cookies'] = $this->__cookies->getAll();
     // Build args array
     $args = array($url, $config);
     // Make request and return response
     return self::__makeRequest($method, $args);
 }
Example #2
0
 public function getSql()
 {
     $columns = $this->columns->getAll();
     if (!$columns) {
         return $this->table ? "{$this->table}.*" : '*';
     }
     $sql = '';
     $counter = 0;
     foreach ($columns as $column) {
         $counter++;
         if ($counter !== 1) {
             $sql .= ",";
         }
         $sql .= $column->getSql();
     }
     return $sql;
 }
 /**
  * Enqueues all scripts
  * 
  */
 protected function __enqueueScripts()
 {
     foreach ($this->enqueue_list->getAll() as $script_id) {
         if ($this->scripts->hasKey($script_id)) {
             $script_obj = $this->scripts->get($script_id);
             $script_obj->enqueue();
         } else {
             $this->scriptAction('enqueue', $script_id);
         }
     }
     return $this;
 }
 /**
  * Returns dependencies
  * 
  * @return array
  */
 public function getDependencies()
 {
     return $this->dependencies->getAll();
 }