Beispiel #1
0
 /**
  * @test
  * @group pmc
  */
 public function testPluralize()
 {
     $name = "test";
     $expected = "tests";
     $this->assertEquals($expected, \Bronto\Utils::pluralize($name));
     $name = "delivery";
     $expected = "deliveries";
     $this->assertEquals($expected, \Bronto\Utils::pluralize($name));
 }
Beispiel #2
0
 /**
  * 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;
 }