@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @implements \PEIP\INF\Context\Context |
143 | 143 | * @access public |
144 | - * @param \PEIP\INF\Context\Context_Plugin $plugin a plugin instance |
|
144 | + * @param \PEIP\INF\Context\ContextPlugin $plugin a plugin instance |
|
145 | 145 | */ |
146 | 146 | public function addPlugin(\PEIP\INF\Context\ContextPlugin $plugin){ |
147 | 147 | $plugin->init($this); |
@@ -173,7 +173,6 @@ discard block |
||
173 | 173 | * </config> |
174 | 174 | * |
175 | 175 | * @access public |
176 | - * @param XMLContext $config the config to include |
|
177 | 176 | */ |
178 | 177 | public function includeContext(XMLContext $context){ |
179 | 178 | $this->services = array_merge($this->services, $context->getServices()); |
@@ -184,7 +183,7 @@ discard block |
||
184 | 183 | * |
185 | 184 | * @see XMLContext::includeContext |
186 | 185 | * @access public |
187 | - * @param XMLContext $context the config to include |
|
186 | + * @param string $filePath |
|
188 | 187 | */ |
189 | 188 | public function includeContextFromFile($filePath){ |
190 | 189 | if(file_exists($filePath)){ |
@@ -363,7 +362,7 @@ discard block |
||
363 | 362 | * |
364 | 363 | * @access public |
365 | 364 | * @param $config |
366 | - * @return object the initialized service instance |
|
365 | + * @return \PEIP\INF\Context\ContextPlugin the initialized service instance |
|
367 | 366 | */ |
368 | 367 | public function createService($config){ |
369 | 368 | return ServiceFactory::createService($config); |
@@ -692,7 +691,7 @@ discard block |
||
692 | 691 | * |
693 | 692 | * @access protected |
694 | 693 | * @param object $config configuration object to create arguments from. |
695 | - * @return mixed build arguments |
|
694 | + * @return \PEIP\INF\Channel\Channel[] build arguments |
|
696 | 695 | */ |
697 | 696 | protected function getReplyHandlerArguments($config){ |
698 | 697 | $args = array( |
@@ -737,7 +736,8 @@ discard block |
||
737 | 736 | * |
738 | 737 | * @access protected |
739 | 738 | * @param string the configuration type ofthe channel (e.g.: 'reply', 'request') |
740 | - * @param object $config configuration object to return channel from. |
|
739 | + * @param object $config configuration object to return channel from. |
|
740 | + * @param string $type |
|
741 | 741 | * @return \PEIP\INF\Channel\Channel reply-channel |
742 | 742 | */ |
743 | 743 | public function doGetChannel($type, $config){ |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | * @see GenericBuilder |
833 | 833 | * @static |
834 | 834 | * @access protected |
835 | - * @param object $className name of class to build instance for. |
|
835 | + * @param string $className name of class to build instance for. |
|
836 | 836 | * @param array $arguments arguments for the constructor |
837 | 837 | * @return object build and modified srvice instance |
838 | 838 | */ |
@@ -840,6 +840,10 @@ discard block |
||
840 | 840 | return GenericBuilder::getInstance($className)->build($arguments); |
841 | 841 | } |
842 | 842 | |
843 | + /** |
|
844 | + * @param string $type |
|
845 | + * @param string $name |
|
846 | + */ |
|
843 | 847 | protected static function hasPublicProperty($service, $type, $name){ |
844 | 848 | $reflection = GenericBuilder::getInstance(get_class($service))->getReflectionClass(); |
845 | 849 | if($reflection->{'has'.$type}($name) && $reflection->{'get'.$type}($name)->isPublic()){ |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | public static function createFromFile($file){ |
95 | 95 | if(file_exists($file)){ |
96 | 96 | return self::createFromString(file_get_contents($file)); |
97 | - }else{ |
|
97 | + } else{ |
|
98 | 98 | throw new \RuntimeException('Cannot open file "'.$file.'".'); |
99 | 99 | } |
100 | 100 | } |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | $setter = self::getSetter($property); |
387 | 387 | if($setter && self::hasPublicProperty($service, 'Method', $setter)){ |
388 | 388 | $service->{$setter}($arg); |
389 | - }elseif(in_array($property, self::hasPublicProperty($service, 'Property', $setter))){ |
|
389 | + } elseif(in_array($property, self::hasPublicProperty($service, 'Property', $setter))){ |
|
390 | 390 | $service->$setter = $arg; |
391 | 391 | } |
392 | 392 | } |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | $ref = trim((string)$config['ref']); |
620 | 620 | if($ref != ''){ |
621 | 621 | $service = $this->getService($ref); |
622 | - }else{ |
|
622 | + } else{ |
|
623 | 623 | $service = $this->createService($config); |
624 | 624 | } |
625 | 625 | return $service; |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | protected static function getSetter($config){ |
640 | 640 | if($config['setter']){ |
641 | 641 | $setter = (string)$config['setter']; |
642 | - }elseif($config['name']){ |
|
642 | + } elseif($config['name']){ |
|
643 | 643 | $setter = 'set'.ucfirst((string)$config['name']); |
644 | 644 | } |
645 | 645 | return $setter; |
@@ -655,26 +655,26 @@ discard block |
||
655 | 655 | protected function buildArg($config){ |
656 | 656 | if(trim((string)$config['value']) != ''){ |
657 | 657 | $arg = (string)$config['value']; |
658 | - }elseif($config->getName() == 'value'){ |
|
658 | + } elseif($config->getName() == 'value'){ |
|
659 | 659 | $arg = (string)$config; |
660 | - }elseif($config->getName() == 'list'){ |
|
660 | + } elseif($config->getName() == 'list'){ |
|
661 | 661 | $arg = array(); |
662 | 662 | foreach($config->children() as $entry){ |
663 | 663 | if($entry->getName() == 'value'){ |
664 | 664 | if($entry['key']){ |
665 | 665 | $arg[(string)$entry['key']] = (string)$entry; |
666 | - }else{ |
|
666 | + } else{ |
|
667 | 667 | $arg[] = (string)$entry; |
668 | 668 | } |
669 | - }elseif($entry->getName() == 'service'){ |
|
669 | + } elseif($entry->getName() == 'service'){ |
|
670 | 670 | $arg[] = $this->provideService($entry); |
671 | 671 | } |
672 | 672 | } |
673 | - }elseif($config->getName() == 'service'){ |
|
673 | + } elseif($config->getName() == 'service'){ |
|
674 | 674 | $arg = $this->provideService($config); |
675 | - }elseif($config->list){ |
|
675 | + } elseif($config->list){ |
|
676 | 676 | $arg = $this->buildArg($config->list); |
677 | - }elseif($config->service){ |
|
677 | + } elseif($config->service){ |
|
678 | 678 | $arg = $this->buildArg($config->service); |
679 | 679 | } |
680 | 680 | return $arg; |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | $channel = $this->services[trim((string)$channelName)]; |
743 | 743 | if($channel instanceof \PEIP\INF\Channel\Channel){ |
744 | 744 | return $channel; |
745 | - }else{ |
|
745 | + } else{ |
|
746 | 746 | return NULL; |
747 | 747 | } |
748 | 748 | } |
@@ -781,10 +781,10 @@ discard block |
||
781 | 781 | $constructor = (string)$config["constructor"]; |
782 | 782 | if($constructor != ''){ |
783 | 783 | $service = call_user_func_array(array($cls, $constructor), $arguments); |
784 | - }else{ |
|
784 | + } else{ |
|
785 | 785 | $service = self::build($cls, $arguments); |
786 | 786 | } |
787 | - }catch(\Exception $e){ |
|
787 | + } catch(\Exception $e){ |
|
788 | 788 | throw new \RuntimeException('Could not create Service "'.$cls.'" -> '.$e->getMessage()); |
789 | 789 | } |
790 | 790 | } |