getMethodCalls() public method

Gets the methods to call after service initialization.
public getMethodCalls ( ) : array
return array An array of method calls
Beispiel #1
0
 protected function addInterfaceInjector(InterfaceInjector $injector, \DOMElement $parent)
 {
     $interface = $this->document->createElement('interface');
     $interface->setAttribute('class', $injector->getClass());
     $this->addMethodCalls($injector->getMethodCalls(), $interface);
     $parent->appendChild($interface);
 }
 /**
  * @covers Symfony\Component\DependencyInjection\InterfaceInjector::merge
  */
 public function testMerge()
 {
     $injector1 = new InterfaceInjector('Symfony\\Tests\\Component\\DependencyInjection\\Service');
     $injector1->addMethodCall('method_one');
     $injector2 = new InterfaceInjector('Symfony\\Tests\\Component\\DependencyInjection\\Service');
     $injector2->addMethodCall('method_two');
     $injector1->merge($injector2);
     $methodCalls = $injector1->getMethodCalls();
     $this->assertEquals(2, count($methodCalls));
     $this->assertEquals(array(array('method_one', array()), array('method_two', array())), $methodCalls);
 }
Beispiel #3
0
 protected function addInterfaceInjector(InterfaceInjector $injector)
 {
     $code = \sprintf("    <interface class=\"%s\">\n", $injector->getClass());
     foreach ($injector->getMethodCalls() as $call) {
         if (count($call[1])) {
             $code .= sprintf("      <call method=\"%s\">\n%s      </call>\n", $call[0], $this->convertParameters($call[1], 'argument', 8));
         } else {
             $code .= sprintf("      <call method=\"%s\" />\n", $call[0]);
         }
     }
     $code .= "    </interface>\n";
     return $code;
 }
Beispiel #4
0
 /**
  * Merges another InterfaceInjector
  *
  * @param InterfaceInjector $injector
  */
 public function merge(InterfaceInjector $injector)
 {
     if ($this->class === $injector->getClass()) {
         foreach ($injector->getMethodCalls() as $call) {
             list($method, $arguments) = $call;
             $this->addMethodCall($method, $arguments);
         }
     }
 }