/**
  * Make the actual API call via curl
  *
  * @param string $method API method that has been called
  * @param array $arguments Arguments that have been passed to it
  * @throws Exception
  * @return object The response object
  */
 public static function __callStatic($method, $arguments = array())
 {
     if (strpos($method, '_')) {
         // underscore method has been used, make it CamelCase
         $method = \Str::lcfirst(\Inflector::camelize($method));
     }
     $default_params = array('apikey' => static::$api_key);
     $extra_params = empty($arguments) ? $arguments : array_shift($arguments);
     $params = array_merge($default_params, $extra_params);
     curl_setopt_array(static::$_connection, array(CURLOPT_URL => static::$api_url . $method, CURLOPT_POSTFIELDS => http_build_query($params)));
     $response = json_decode(curl_exec(static::$_connection));
     if (@$response->error) {
         throw new \FuelException('Error #' . $response->code . ': ' . $response->error);
     }
     return $response;
 }
Beispiel #2
0
 /**
  * Test for Str::lcfirst()
  *
  * @test
  */
 public function test_lcfirst()
 {
     $output = Str::lcfirst('Hello World');
     $expected = "hello World";
     $this->assertEquals($expected, $output);
 }