private function loadBinding(Definitions $definitions, DOMElement $node) { $binding = new Binding($definitions, $node->getAttribute("name")); $binding->setDocumentation($this->getDocumentation($node)); $definitions->addBinding($binding); $functions = array(); foreach ($this->loop($node) as $childNode) { switch ($childNode->localName) { case 'operation': $functions[] = $this->loadBindingOperation($binding, $childNode); break; } } return function () use($functions, $binding, $definitions, $node) { list($name, $ns) = self::splitParts($node, $node->getAttribute("type")); $binding->setType($definitions->findPortType($name, $ns)); $this->dispatcher->dispatch('binding', new BindingEvent($binding, $node)); foreach ($functions as $function) { call_user_func($function); } }; }