/** * Proxy PHP functions * * @param string $name * @param array $args * @return mixed */ public function __call($name, $args) { $function = $this->_prefix . Bronto_Utils::underscore($name); if (!function_exists($function)) { throw new BadMethodCallException("Resource function {$function} does not exist."); } if (!array_key_exists($name, $this->_excluded) && !is_null($this->_resource)) { array_unshift($args, $this->_resource); } $return = call_user_func_array($function, $args); if ($name == 'close') { unset($this->_resource); $this->_resource = null; return $this; } if (is_resource($return)) { $this->_resource = $return; return $this; } return $return; }
/** * Returns a tuple of a prefixed camel-case name, ie: * $this->_camelizedValue('addSomething') == array('add', 'something') * * @param string $name * @return array($prefixed, $camelized) */ protected function _camelizedValue($name) { if (preg_match('/^([^A-Z0-9]+).+/', $name, $match)) { $modified = $this->_stripAndLower($name, strlen($match[1])); return array($match[1], $this->_underscore ? Bronto_Utils::underscore($modified) : $modified); } return array("", ""); }