@@ -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 | } |
@@ -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 | |
@@ -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 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 = $this->buildArg($config->list); |
| 111 | - }elseif($config->service){ |
|
| 111 | + } elseif($config->service){ |
|
| 112 | 112 | $arg = $this->buildArg($config->service); |
| 113 | 113 | } |
| 114 | 114 | return $arg; |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | public static function buildAndModify(array $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(isset($config['argument'])){ |
| 140 | 140 | foreach($config['argument'] as $arg){ |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $setter = self::getSetter($property); |
| 176 | 176 | if($setter && self::hasPublicProperty($service, 'Method', $setter)){ |
| 177 | 177 | $service->{$setter}($arg); |
| 178 | - }elseif(in_array($property, self::hasPublicProperty($service, 'Property', $setter))){ |
|
| 178 | + } elseif(in_array($property, self::hasPublicProperty($service, 'Property', $setter))){ |
|
| 179 | 179 | $service->$setter = $arg; |
| 180 | 180 | } |
| 181 | 181 | } |
@@ -30,8 +30,7 @@ discard block |
||
| 30 | 30 | throw new \Exception('loading XML failed'); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - } |
|
| 34 | - catch(\Exception $e){ |
|
| 33 | + } catch(\Exception $e){ |
|
| 35 | 34 | return false; |
| 36 | 35 | } |
| 37 | 36 | |
@@ -65,7 +64,7 @@ discard block |
||
| 65 | 64 | ) |
| 66 | 65 | ); |
| 67 | 66 | } |
| 68 | - }else{ |
|
| 67 | + } else{ |
|
| 69 | 68 | $array[$name] = array(); |
| 70 | 69 | } |
| 71 | 70 | $array[$name][] = $res; |
@@ -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 | } |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | $setter = self::getSetter($property); |
| 386 | 386 | if($setter && self::hasPublicProperty($service, 'Method', $setter)){ |
| 387 | 387 | $service->{$setter}($arg); |
| 388 | - }elseif(in_array($property, self::hasPublicProperty($service, 'Property', $setter))){ |
|
| 388 | + } elseif(in_array($property, self::hasPublicProperty($service, 'Property', $setter))){ |
|
| 389 | 389 | $service->$setter = $arg; |
| 390 | 390 | } |
| 391 | 391 | } |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | $ref = trim((string)$config['ref']); |
| 619 | 619 | if($ref != ''){ |
| 620 | 620 | $service = $this->getService($ref); |
| 621 | - }else{ |
|
| 621 | + } else{ |
|
| 622 | 622 | $service = $this->createService($config); |
| 623 | 623 | } |
| 624 | 624 | return $service; |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | protected static function getSetter($config){ |
| 639 | 639 | if($config['setter']){ |
| 640 | 640 | $setter = (string)$config['setter']; |
| 641 | - }elseif($config['name']){ |
|
| 641 | + } elseif($config['name']){ |
|
| 642 | 642 | $setter = 'set'.ucfirst((string)$config['name']); |
| 643 | 643 | } |
| 644 | 644 | return $setter; |
@@ -654,26 +654,26 @@ discard block |
||
| 654 | 654 | protected function buildArg($config){ |
| 655 | 655 | if(trim((string)$config['value']) != ''){ |
| 656 | 656 | $arg = (string)$config['value']; |
| 657 | - }elseif($config->getName() == 'value'){ |
|
| 657 | + } elseif($config->getName() == 'value'){ |
|
| 658 | 658 | $arg = (string)$config; |
| 659 | - }elseif($config->getName() == 'list'){ |
|
| 659 | + } elseif($config->getName() == 'list'){ |
|
| 660 | 660 | $arg = array(); |
| 661 | 661 | foreach($config->children() as $entry){ |
| 662 | 662 | if($entry->getName() == 'value'){ |
| 663 | 663 | if($entry['key']){ |
| 664 | 664 | $arg[(string)$entry['key']] = (string)$entry; |
| 665 | - }else{ |
|
| 665 | + } else{ |
|
| 666 | 666 | $arg[] = (string)$entry; |
| 667 | 667 | } |
| 668 | - }elseif($entry->getName() == 'service'){ |
|
| 668 | + } elseif($entry->getName() == 'service'){ |
|
| 669 | 669 | $arg[] = $this->provideService($entry); |
| 670 | 670 | } |
| 671 | 671 | } |
| 672 | - }elseif($config->getName() == 'service'){ |
|
| 672 | + } elseif($config->getName() == 'service'){ |
|
| 673 | 673 | $arg = $this->provideService($config); |
| 674 | - }elseif($config->list){ |
|
| 674 | + } elseif($config->list){ |
|
| 675 | 675 | $arg = $this->buildArg($config->list); |
| 676 | - }elseif($config->service){ |
|
| 676 | + } elseif($config->service){ |
|
| 677 | 677 | $arg = $this->buildArg($config->service); |
| 678 | 678 | } |
| 679 | 679 | return $arg; |
@@ -774,10 +774,10 @@ discard block |
||
| 774 | 774 | $constructor = (string)$config["constructor"]; |
| 775 | 775 | if($constructor != ''){ |
| 776 | 776 | $service = call_user_func_array(array($cls, $constructor), $arguments); |
| 777 | - }else{ |
|
| 777 | + } else{ |
|
| 778 | 778 | $service = self::build($cls, $arguments); |
| 779 | 779 | } |
| 780 | - }catch(\Exception $e){ |
|
| 780 | + } catch(\Exception $e){ |
|
| 781 | 781 | throw new \RuntimeException('Could not create Service "'.$cls.'" -> '.$e->getMessage()); |
| 782 | 782 | } |
| 783 | 783 | } |
@@ -134,12 +134,10 @@ |
||
| 134 | 134 | $res = false; |
| 135 | 135 | try { |
| 136 | 136 | $res = (string)$this->getContent(); |
| 137 | - } |
|
| 138 | - catch(\Exception $e){ |
|
| 137 | + } catch(\Exception $e){ |
|
| 139 | 138 | try { |
| 140 | 139 | $res = get_class($this->getContent()); |
| 141 | - } |
|
| 142 | - catch(\Exception $e){ |
|
| 140 | + } catch(\Exception $e){ |
|
| 143 | 141 | return ""; |
| 144 | 142 | } |
| 145 | 143 | } |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | public function execute(){ |
| 55 | 55 | if(is_callable($this->getContent())){ |
| 56 | 56 | return call_user_func($this->getContent()); |
| 57 | - }else{ |
|
| 57 | + } else{ |
|
| 58 | 58 | return $this->getContent()->execute(); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | if($static && !$reflectionFunc->isStatic()){ |
| 57 | 57 | throw new \InvalidArgumentException('Argument 1 passed to CallableMessageHandler::__construct is not an Callable: Method "'.$method.'" of class '.$class.' is not static.'); |
| 58 | 58 | } |
| 59 | - }else{ |
|
| 59 | + } else{ |
|
| 60 | 60 | $reflectionFunc = new \ReflectionFunction($this->callable); |
| 61 | 61 | } |
| 62 | 62 | $this->requiredParameters = $reflectionFunc->getNumberOfRequiredParameters(); |
| 63 | - }else{ |
|
| 63 | + } else{ |
|
| 64 | 64 | throw new \InvalidArgumentException('Argument 1 passed to CallableMessageHandler::__construct is not a Callable'); |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -79,8 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | try { |
| 81 | 81 | return call_user_func_array($this->callable, array($message, $channel, $sent)); |
| 82 | - } |
|
| 83 | - catch(\Exception $e){ |
|
| 82 | + } catch(\Exception $e){ |
|
| 84 | 83 | throw new \RuntimeException('Unable to call Callable: '.$e->getMessage()); |
| 85 | 84 | } |
| 86 | 85 | } |