@@ -39,7 +39,7 @@ |
||
| 39 | 39 | * |
| 40 | 40 | * @access public |
| 41 | 41 | * @param string $className class-name to create objects for |
| 42 | - * @param ReflectionClass $reflectionClass reflection-class for class. default: NULL |
|
| 42 | + * @param \ReflectionClass $reflectionClass reflection-class for class. default: NULL |
|
| 43 | 43 | * @param boolean $storeRef wether to store a reference for new instance. default: true |
| 44 | 44 | * @return |
| 45 | 45 | */ |
@@ -83,7 +83,6 @@ |
||
| 83 | 83 | * @param ObjectEventDispatcher $dispatcher the dispatcher to dispatch the event |
| 84 | 84 | * @param mixed $subject the subject for the event |
| 85 | 85 | * @param string $name the name of the event |
| 86 | - * @param array $parameters the headers for the event |
|
| 87 | 86 | * @return |
| 88 | 87 | */ |
| 89 | 88 | public function buildAndDispatch(ObjectEventDispatcher $dispatcher, $subject, $name, array $headers = array()){ |
@@ -47,6 +47,9 @@ |
||
| 47 | 47 | return new DedicatedFactory(array($class, '__construct'), $parameters); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | + /** |
|
| 51 | + * @param string[] $callable |
|
| 52 | + */ |
|
| 50 | 53 | public static function getfromCallable($callable, array $parameters = array()){
|
| 51 | 54 | return new DedicatedFactory($callable, $parameters); |
| 52 | 55 | } |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | * @see GenericBuilder |
| 72 | 72 | * @static |
| 73 | 73 | * @access protected |
| 74 | - * @param object $className name of class to build instance for. |
|
| 74 | + * @param string $className name of class to build instance for. |
|
| 75 | 75 | * @param array $arguments arguments for the constructor |
| 76 | 76 | * @return object build and modified srvice instance |
| 77 | 77 | */ |
@@ -51,10 +51,10 @@ discard block |
||
| 51 | 51 | $constructor = isset($config["constructor"])?(string)$config["constructor"]:""; |
| 52 | 52 | if($constructor != '' && Test::assertMethod($cls, $constructor)){
|
| 53 | 53 | $service = call_user_func_array(array($cls, $constructor), $arguments); |
| 54 | - }else{
|
|
| 54 | + } else{
|
|
| 55 | 55 | $service = self::build($cls, $arguments); |
| 56 | 56 | } |
| 57 | - }catch(\Exception $e){
|
|
| 57 | + } catch(\Exception $e){
|
|
| 58 | 58 | throw new \RuntimeException('Could not create Service "'.$cls.'" -> '.$e->getMessage());
|
| 59 | 59 | } |
| 60 | 60 | } |
@@ -89,26 +89,26 @@ discard block |
||
| 89 | 89 | protected static function buildArg($config){
|
| 90 | 90 | if(trim((string)$config['value']) != ''){
|
| 91 | 91 | $arg = (string)$config['value']; |
| 92 | - }elseif($config->getName() == 'value'){
|
|
| 92 | + } elseif($config->getName() == 'value'){
|
|
| 93 | 93 | $arg = (string)$config; |
| 94 | - }elseif($config->getName() == 'list'){
|
|
| 94 | + } elseif($config->getName() == 'list'){
|
|
| 95 | 95 | $arg = array(); |
| 96 | 96 | foreach($config->children() as $entry){
|
| 97 | 97 | if($entry->getName() == 'value'){
|
| 98 | 98 | if($entry['key']){
|
| 99 | 99 | $arg[(string)$entry['key']] = (string)$entry; |
| 100 | - }else{
|
|
| 100 | + } else{
|
|
| 101 | 101 | $arg[] = (string)$entry; |
| 102 | 102 | } |
| 103 | - }elseif($entry->getName() == 'service'){
|
|
| 103 | + } elseif($entry->getName() == 'service'){
|
|
| 104 | 104 | $arg[] = $this->provideService($entry); |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | - }elseif($config->getName() == 'service'){
|
|
| 107 | + } elseif($config->getName() == 'service'){
|
|
| 108 | 108 | $arg = self::provideService($config); |
| 109 | - }elseif($config->list){
|
|
| 109 | + } elseif($config->list){
|
|
| 110 | 110 | $arg = self::buildArg($config->list); |
| 111 | - }elseif($config->service){
|
|
| 111 | + } elseif($config->service){
|
|
| 112 | 112 | $arg = self::buildArg($config->service); |
| 113 | 113 | } |
| 114 | 114 | return $arg; |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | public static function buildAndModify($config, $arguments, $defaultClass = ""){
|
| 130 | 130 | if((isset($config["class"]) && "" != (string)$config["class"]) || $defaultClass !== ""){
|
| 131 | 131 | $service = ServiceFactory::doBuild($config, $arguments, $defaultClass); |
| 132 | - }else{
|
|
| 132 | + } else{
|
|
| 133 | 133 | throw new \RuntimeException('Could not create Service. no class or reference given.');
|
| 134 | 134 | } |
| 135 | 135 | if(isset($config["ref_property"])){
|
| 136 | 136 | $service = $service->{(string)$config["ref_property"]};
|
| 137 | - }elseif(isset($config["ref_method"])){
|
|
| 137 | + } elseif(isset($config["ref_method"])){
|
|
| 138 | 138 | $args = array(); |
| 139 | 139 | if($config->argument){
|
| 140 | 140 | foreach($config->argument as $arg){
|
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $setter = self::getSetter($property); |
| 178 | 178 | if($setter && self::hasPublicProperty($service, 'Method', $setter)){
|
| 179 | 179 | $service->{$setter}($arg);
|
| 180 | - }elseif(in_array($property, self::hasPublicProperty($service, 'Property', $setter))){
|
|
| 180 | + } elseif(in_array($property, self::hasPublicProperty($service, 'Property', $setter))){
|
|
| 181 | 181 | $service->$setter = $arg; |
| 182 | 182 | } |
| 183 | 183 | } |
@@ -112,6 +112,9 @@ |
||
| 112 | 112 | ); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | + /** |
|
| 116 | + * @param string $key |
|
| 117 | + */ |
|
| 115 | 118 | public function provideService($key){
|
| 116 | 119 | $this->doFireEvent(self::EVENT_BEFORE_PROVIDE_SERVICE, array( |
| 117 | 120 | self::HEADER_KEY=>$key) |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | if($this->hasService($key)){ |
| 120 | 120 | $service = $this->getService($key); |
| 121 | - }else{ |
|
| 121 | + } else{ |
|
| 122 | 122 | $service = $this->createService($key); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -150,11 +150,11 @@ discard block |
||
| 150 | 150 | )); |
| 151 | 151 | |
| 152 | 152 | return $node; |
| 153 | - }else{ |
|
| 153 | + } else{ |
|
| 154 | 154 | $errorMessage = 'COULD NOT BUILD NODE FOR KEY: '.$key; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - }else{ |
|
| 157 | + } else{ |
|
| 158 | 158 | $errorMessage = 'NO CONFIG FOR KEY: '.$key; |
| 159 | 159 | } |
| 160 | 160 | $this->doFireEvent(self::EVENT_CREATE_SERVICE_ERROR, array( |
@@ -198,10 +198,10 @@ discard block |
||
| 198 | 198 | self::HEADER_NODE => $nodeInstance |
| 199 | 199 | )); |
| 200 | 200 | return $nodeInstance; |
| 201 | - }else{ |
|
| 201 | + } else{ |
|
| 202 | 202 | $errorMessage = 'BUILDER RETURNED NO OBJECT FOR NODE-TYPE: '.$nodeName; |
| 203 | 203 | } |
| 204 | - }else{ |
|
| 204 | + } else{ |
|
| 205 | 205 | $errorMessage = 'NO BUILDER FOUND FOR NODE-TYPE: '.$nodeName; |
| 206 | 206 | } |
| 207 | 207 | |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | if($cold){ |
| 40 | 40 | $type = 'cold'; |
| 41 | 41 | $count = $this->coldDrinkCounter; |
| 42 | - }else{ |
|
| 42 | + } else{ |
|
| 43 | 43 | $type = 'hot'; |
| 44 | 44 | $count = $this->hotDrinkCounter; |
| 45 | 45 | } |
@@ -70,10 +70,10 @@ |
||
| 70 | 70 | ), |
| 71 | 71 | $object |
| 72 | 72 | ); |
| 73 | - }else{
|
|
| 73 | + } else{
|
|
| 74 | 74 | throw new \InvalidArgumentException('instance of \PEIP\INF\Event\Event must contain subject');
|
| 75 | 75 | } |
| 76 | - }else{
|
|
| 76 | + } else{
|
|
| 77 | 77 | throw new \InvalidArgumentException('object must be instance of \PEIP\INF\Event\Event');
|
| 78 | 78 | } |
| 79 | 79 | } //put your code here |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @access public |
| 24 | 24 | * @param string $name name of the event |
| 25 | 25 | * @param \PEIP\INF\Event\Event $object an event object |
| 26 | - * @return boolean |
|
| 26 | + * @return boolean|null |
|
| 27 | 27 | */ |
| 28 | 28 | public function notify($name, $object){
|
| 29 | 29 | if($object instanceof \PEIP\INF\Event\Event){
|
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @param array $headers headers of the event-object as key/value pairs |
| 54 | 54 | * @param string $eventClass event-class to create instances from |
| 55 | 55 | * @return |
| 56 | - * @see EventBuilder |
|
| 56 | + boolean|null @see EventBuilder |
|
| 57 | 57 | */ |
| 58 | 58 | public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false){
|
| 59 | 59 | if(!$this->hasListeners($name, ($object))){
|
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | class_exists($className); |
| 44 | 44 | $res = ReflectionPool::getInstance($className) |
| 45 | 45 | ->implementsInterface($interfaceName); |
| 46 | - } catch (\Exception $e){ |
|
| 46 | + } catch (\Exception $e){ |
|
| 47 | 47 | $res = false; |
| 48 | 48 | } |
| 49 | 49 | return $res;; |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | var_dump($drinks); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | -}else{
|
|
| 60 | +} else{
|
|
| 61 | 61 | throw new RuntimeException('Could not get CafeGateway');
|
| 62 | 62 | } |
| 63 | 63 | |