/** * Proxy PHP functions * * @param string $name * @param array $args * @return mixed */ public function __call($name, $args) { $function = $this->_prefix . 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; }
/** * @test * @group pmc */ public function testUnderscore() { $name = "someCamelCase"; $expected = "some_camel_case"; $this->assertEquals($expected, \Bronto\Utils::underscore($name)); }