예제 #1
0
 /**
  * Add methods
  */
 function it_add_methods(CodeFactoryContract $factory, PHPMethod $method)
 {
     $factory->buildMethod($name = 'foo', $parameters = ['FooClass $p1'], $modifiers = 'bar')->willReturn($method)->shouldBeCalled();
     $this->method($name, $parameters, $modifiers)->shouldReturn($this);
     $this->getMethods()->shouldBe([$method]);
 }
예제 #2
0
 /**
  * Add a method to the class
  *
  * @param string $method
  * @param array  $parameters
  * @param int    $modifiers
  *
  * @return PHPMethod
  */
 public function method($method, $parameters = [], $modifiers = 0)
 {
     $this->methods[] = $this->codeFactory->buildMethod($method, $parameters, $modifiers);
     return $this;
 }