private function loadPortType(Definitions $definitions, DOMElement $node) { $port = new PortType($definitions, $node->getAttribute("name")); $port->setDocumentation($this->getDocumentation($node)); $definitions->addPortType($port); $functions = array(); foreach ($this->loop($node) as $childNode) { switch ($childNode->localName) { case 'operation': $functions[] = $this->loadPortTypeOperation($port, $childNode); break; } } return function () use($functions, $port, $node) { $this->dispatcher->dispatch('portType', new PortTypeEvent($port, $node)); foreach ($functions as $function) { call_user_func($function); } }; }