/** * Returns a single registration hook by ID * * @param string $id ID of the target registration hook * @return \Ponticlaro\Bebop\ScriptsLoader\Patterns\ScriptsHook */ public function getHook($id) { if (!is_string($id)) { return null; } return $this->hooks->get($id); }
/** * 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); }
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; }
/** * Executes any function that exists for the current environment * */ protected function __applyEnvModifications() { // Get current environment $current_env = EnvManager::getInstance()->getCurrentKey(); // Execute current environment function if ($this->env_configs->hasKey($current_env)) { call_user_func_array($this->env_configs->get($current_env), array($this)); } }