@@ -3,30 +3,30 @@ |
||
| 3 | 3 | |
| 4 | 4 | class Drink { |
| 5 | 5 | |
| 6 | - protected |
|
| 7 | - $orderNumber, |
|
| 8 | - $type, |
|
| 9 | - $iced; |
|
| 6 | + protected |
|
| 7 | + $orderNumber, |
|
| 8 | + $type, |
|
| 9 | + $iced; |
|
| 10 | 10 | |
| 11 | - public function __construct($orderNumber, $type, $iced){ |
|
| 12 | - $this->orderNumber = $orderNumber; |
|
| 13 | - $this->type = $type; |
|
| 14 | - $this->iced = $iced; |
|
| 15 | - } |
|
| 11 | + public function __construct($orderNumber, $type, $iced){ |
|
| 12 | + $this->orderNumber = $orderNumber; |
|
| 13 | + $this->type = $type; |
|
| 14 | + $this->iced = $iced; |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | - public function getType(){ |
|
| 18 | - return $this->type; |
|
| 19 | - } |
|
| 17 | + public function getType(){ |
|
| 18 | + return $this->type; |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - public function getIced(){ |
|
| 22 | - return $this->iced; |
|
| 23 | - } |
|
| 21 | + public function getIced(){ |
|
| 22 | + return $this->iced; |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - public function getOrderNumber(){ |
|
| 26 | - return $this->orderNumber; |
|
| 27 | - } |
|
| 25 | + public function getOrderNumber(){ |
|
| 26 | + return $this->orderNumber; |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - public function __sleep() |
|
| 29 | + public function __sleep() |
|
| 30 | 30 | { |
| 31 | 31 | return array('orderNumber', 'type', 'iced'); |
| 32 | 32 | } |
@@ -8,21 +8,21 @@ |
||
| 8 | 8 | $type, |
| 9 | 9 | $iced; |
| 10 | 10 | |
| 11 | - public function __construct($orderNumber, $type, $iced){ |
|
| 11 | + public function __construct($orderNumber, $type, $iced) { |
|
| 12 | 12 | $this->orderNumber = $orderNumber; |
| 13 | 13 | $this->type = $type; |
| 14 | 14 | $this->iced = $iced; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - public function getType(){ |
|
| 17 | + public function getType() { |
|
| 18 | 18 | return $this->type; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function getIced(){ |
|
| 21 | + public function getIced() { |
|
| 22 | 22 | return $this->iced; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function getOrderNumber(){ |
|
| 25 | + public function getOrderNumber() { |
|
| 26 | 26 | return $this->orderNumber; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -2,11 +2,11 @@ |
||
| 2 | 2 | |
| 3 | 3 | class DrinkType { |
| 4 | 4 | |
| 5 | - const |
|
| 6 | - ESPRESSO = 'ESPRESSO', |
|
| 7 | - LATTE = 'LATTE', |
|
| 8 | - CAPPUCCINO = 'CAPPUCCINO', |
|
| 9 | - MOCCA = 'MOCCA'; |
|
| 5 | + const |
|
| 6 | + ESPRESSO = 'ESPRESSO', |
|
| 7 | + LATTE = 'LATTE', |
|
| 8 | + CAPPUCCINO = 'CAPPUCCINO', |
|
| 9 | + MOCCA = 'MOCCA'; |
|
| 10 | 10 | |
| 11 | 11 | } |
| 12 | 12 | |
@@ -3,22 +3,22 @@ |
||
| 3 | 3 | |
| 4 | 4 | class Waiter { |
| 5 | 5 | |
| 6 | - protected $orders; |
|
| 6 | + protected $orders; |
|
| 7 | 7 | |
| 8 | - public function prepareDelivery(array $drinks){ |
|
| 9 | - echo PEIP_LINE_SEPARATOR.'Waiter: prepareDelivery: #'.$drinks[0]->getOrderNumber(); |
|
| 10 | - return new Delivery($drinks); |
|
| 11 | - } |
|
| 8 | + public function prepareDelivery(array $drinks){ |
|
| 9 | + echo PEIP_LINE_SEPARATOR.'Waiter: prepareDelivery: #'.$drinks[0]->getOrderNumber(); |
|
| 10 | + return new Delivery($drinks); |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | 13 | |
| 14 | - public function receiveOrder(Order $order){ |
|
| 15 | - echo PEIP_LINE_SEPARATOR.'Waiter: receiveOrder'; |
|
| 16 | - $this->orders[$order->getOrderNumber()] = $order; |
|
| 17 | - } |
|
| 14 | + public function receiveOrder(Order $order){ |
|
| 15 | + echo PEIP_LINE_SEPARATOR.'Waiter: receiveOrder'; |
|
| 16 | + $this->orders[$order->getOrderNumber()] = $order; |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - public function getOrder($nr){ |
|
| 20 | - return $this->orders[$nr]; |
|
| 21 | - } |
|
| 19 | + public function getOrder($nr){ |
|
| 20 | + return $this->orders[$nr]; |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | 23 | |
| 24 | 24 | } |
@@ -5,18 +5,18 @@ |
||
| 5 | 5 | |
| 6 | 6 | protected $orders; |
| 7 | 7 | |
| 8 | - public function prepareDelivery(array $drinks){ |
|
| 8 | + public function prepareDelivery(array $drinks) { |
|
| 9 | 9 | echo PEIP_LINE_SEPARATOR.'Waiter: prepareDelivery: #'.$drinks[0]->getOrderNumber(); |
| 10 | 10 | return new Delivery($drinks); |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | |
| 14 | - public function receiveOrder(Order $order){ |
|
| 14 | + public function receiveOrder(Order $order) { |
|
| 15 | 15 | echo PEIP_LINE_SEPARATOR.'Waiter: receiveOrder'; |
| 16 | 16 | $this->orders[$order->getOrderNumber()] = $order; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - public function getOrder($nr){ |
|
| 19 | + public function getOrder($nr) { |
|
| 20 | 20 | return $this->orders[$nr]; |
| 21 | 21 | } |
| 22 | 22 | |
@@ -32,11 +32,11 @@ |
||
| 32 | 32 | protected $services = array(); |
| 33 | 33 | |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Constructor. |
|
| 37 | - * |
|
| 38 | - * @param array $parameters An array of parameters |
|
| 39 | - */ |
|
| 35 | + /** |
|
| 36 | + * Constructor. |
|
| 37 | + * |
|
| 38 | + * @param array $parameters An array of parameters |
|
| 39 | + */ |
|
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | class ServiceContainer |
| 28 | 28 | extends \PEIP\ABS\Base\Connectable |
| 29 | 29 | implements |
| 30 | - \PEIP\INF\Service\ServiceContainer{
|
|
| 30 | + \PEIP\INF\Service\ServiceContainer {
|
|
| 31 | 31 | |
| 32 | 32 | protected $services = array(); |
| 33 | 33 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param $service |
| 46 | 46 | * @return |
| 47 | 47 | */ |
| 48 | - public function setService($key, $service){
|
|
| 48 | + public function setService($key, $service) {
|
|
| 49 | 49 | $this->services[$key] = $service; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @param $key |
| 56 | 56 | * @return |
| 57 | 57 | */ |
| 58 | - public function getService($key){
|
|
| 58 | + public function getService($key) {
|
|
| 59 | 59 | return $this->services[$key]; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param $key |
| 66 | 66 | * @return |
| 67 | 67 | */ |
| 68 | - public function hasService($key){
|
|
| 68 | + public function hasService($key) {
|
|
| 69 | 69 | return array_key_exists($key, $this->services); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @param $key |
| 76 | 76 | * @return |
| 77 | 77 | */ |
| 78 | - public function deleteService($key){
|
|
| 78 | + public function deleteService($key) {
|
|
| 79 | 79 | unset($this->services[$key]); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | use \PEIP\Data\InternalStoreAbstract; |
| 26 | 26 | use PEIP\Factory\DedicatedFactory; |
| 27 | 27 | |
| 28 | -class ServiceContainerBuilder extends \PEIP\Data\InternalStoreAbstract{
|
|
| 28 | +class ServiceContainerBuilder extends \PEIP\Data\InternalStoreAbstract {
|
|
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @param $factory |
| 36 | 36 | * @return |
| 37 | 37 | */ |
| 38 | - public function setFactory($key, DedicatedFactory $factory){
|
|
| 38 | + public function setFactory($key, DedicatedFactory $factory) {
|
|
| 39 | 39 | $this->setInternalValue($key, $factory); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param $key |
| 46 | 46 | * @return |
| 47 | 47 | */ |
| 48 | - public function getFactory($key){
|
|
| 48 | + public function getFactory($key) {
|
|
| 49 | 49 | $this->getInternalValue($key); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @param $key |
| 56 | 56 | * @return |
| 57 | 57 | */ |
| 58 | - public function hasFactory($key){
|
|
| 58 | + public function hasFactory($key) {
|
|
| 59 | 59 | $this->hasInternalValue($key); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param $key |
| 66 | 66 | * @return |
| 67 | 67 | */ |
| 68 | - public function deleteFactory($key){
|
|
| 68 | + public function deleteFactory($key) {
|
|
| 69 | 69 | $this->deleteInternalValue($key); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @param $key |
| 76 | 76 | * @return |
| 77 | 77 | */ |
| 78 | - public function getService($key){
|
|
| 78 | + public function getService($key) {
|
|
| 79 | 79 | return isset($this->services[$key]) ? $this->services[$key] : $this->services[$key] = $this->getFactory($key)->build(); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @param $key |
| 87 | 87 | * @return |
| 88 | 88 | */ |
| 89 | - public function buildService($key){
|
|
| 89 | + public function buildService($key) {
|
|
| 90 | 90 | return $this->getFactory($key)->build(); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -31,13 +31,13 @@ |
||
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | - * Calls a method on a service (registered as a callable) with |
|
| 35 | - * content/payload of given message as argument. |
|
| 36 | - * |
|
| 37 | - * @access protected |
|
| 38 | - * @param \PEIP\INF\Message\Message $message message to call the service with it�s content/payload |
|
| 39 | - * @return mixed result of calling the registered service callable with message content/payload |
|
| 40 | - */ |
|
| 34 | + * Calls a method on a service (registered as a callable) with |
|
| 35 | + * content/payload of given message as argument. |
|
| 36 | + * |
|
| 37 | + * @access protected |
|
| 38 | + * @param \PEIP\INF\Message\Message $message message to call the service with it�s content/payload |
|
| 39 | + * @return mixed result of calling the registered service callable with message content/payload |
|
| 40 | + */ |
|
| 41 | 41 | protected function callService(\PEIP\INF\Message\Message $message){
|
| 42 | 42 | $res = NULL; |
| 43 | 43 | if(is_callable($this->serviceCallable)){
|
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * @author timo |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class HeaderServiceActivator extends \PEIP\Service\ServiceActivator{
|
|
| 15 | +class HeaderServiceActivator extends \PEIP\Service\ServiceActivator {
|
|
| 16 | 16 | |
| 17 | 17 | protected $headerName; |
| 18 | 18 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @param $outputChannel |
| 25 | 25 | * @return |
| 26 | 26 | */ |
| 27 | - public function __construct($serviceCallable, $headerName, \PEIP\INF\Channel\Channel $inputChannel = NULL, \PEIP\INF\Channel\Channel $outputChannel = NULL){
|
|
| 27 | + public function __construct($serviceCallable, $headerName, \PEIP\INF\Channel\Channel $inputChannel = NULL, \PEIP\INF\Channel\Channel $outputChannel = NULL) {
|
|
| 28 | 28 | $this->headerName = $headerName; |
| 29 | 29 | parent::__construct($serviceCallable, $inputChannel, $outputChannel); |
| 30 | 30 | } |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | * @param \PEIP\INF\Message\Message $message message to call the service with it�s content/payload |
| 39 | 39 | * @return mixed result of calling the registered service callable with message content/payload |
| 40 | 40 | */ |
| 41 | - protected function callService(\PEIP\INF\Message\Message $message){
|
|
| 41 | + protected function callService(\PEIP\INF\Message\Message $message) {
|
|
| 42 | 42 | $res = NULL; |
| 43 | - if(is_callable($this->serviceCallable)){
|
|
| 43 | + if (is_callable($this->serviceCallable)) {
|
|
| 44 | 44 | $res = call_user_func($this->serviceCallable, $message->getHeader($this->headerName)); |
| 45 | - }else{
|
|
| 46 | - if(is_object($this->serviceCallable) && method_exists($this->serviceCallable, 'handle')){
|
|
| 45 | + }else {
|
|
| 46 | + if (is_object($this->serviceCallable) && method_exists($this->serviceCallable, 'handle')) {
|
|
| 47 | 47 | $res = $this->serviceCallable->handle($message->getHeader($this->headerName)); |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | protected function getMessage($object){
|
| 18 | 18 | if($this->channel instanceof \PEIP\INF\Channel\SubscribableChannel){
|
| 19 | 19 | return $object; |
| 20 | - }else{
|
|
| 20 | + } else{
|
|
| 21 | 21 | return $object->getContent()->receive(); |
| 22 | 22 | } |
| 23 | 23 | } |
@@ -33,12 +33,12 @@ |
||
| 33 | 33 | * @param $outputChannel |
| 34 | 34 | * @return |
| 35 | 35 | */ |
| 36 | - public function __construct($serviceCallable, \PEIP\INF\Channel\Channel $inputChannel = NULL, \PEIP\INF\Channel\Channel $outputChannel = NULL){
|
|
| 36 | + public function __construct($serviceCallable, \PEIP\INF\Channel\Channel $inputChannel = NULL, \PEIP\INF\Channel\Channel $outputChannel = NULL) {
|
|
| 37 | 37 | $this->serviceCallable = $serviceCallable; |
| 38 | - if(is_object($inputChannel)){
|
|
| 38 | + if (is_object($inputChannel)) {
|
|
| 39 | 39 | $this->setInputChannel($inputChannel); |
| 40 | 40 | } |
| 41 | - if(is_object($outputChannel)){
|
|
| 41 | + if (is_object($outputChannel)) {
|
|
| 42 | 42 | $this->setOutputChannel($outputChannel); |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -26,8 +26,7 @@ discard block |
||
| 26 | 26 | $array = array(); |
| 27 | 27 | try {
|
| 28 | 28 | $node = simplexml_load_string($content); |
| 29 | - } |
|
| 30 | - catch(\Exception $e){
|
|
| 29 | + } catch(\Exception $e){
|
|
| 31 | 30 | return false; |
| 32 | 31 | } |
| 33 | 32 | |
@@ -61,7 +60,7 @@ discard block |
||
| 61 | 60 | ) |
| 62 | 61 | ); |
| 63 | 62 | } |
| 64 | - }else{
|
|
| 63 | + } else{
|
|
| 65 | 64 | $array[$name] = array(); |
| 66 | 65 | } |
| 67 | 66 | $array[$name][] = $res; |
@@ -22,43 +22,43 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | class XMLArrayTranslator {
|
| 24 | 24 | |
| 25 | - public static function translate($content){
|
|
| 25 | + public static function translate($content) {
|
|
| 26 | 26 | $array = array(); |
| 27 | 27 | try {
|
| 28 | 28 | $node = simplexml_load_string($content); |
| 29 | 29 | // fix for hhvm |
| 30 | - if(!($node instanceof \SimpleXMLElement)){
|
|
| 30 | + if (!($node instanceof \SimpleXMLElement)) {
|
|
| 31 | 31 | throw new \Exception('loading XML failed');
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | } |
| 35 | - catch(\Exception $e){
|
|
| 35 | + catch (\Exception $e) {
|
|
| 36 | 36 | return false; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | return self::doTranslate($node); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - protected static function doTranslate(\SimpleXMLElement $node){
|
|
| 42 | + protected static function doTranslate(\SimpleXMLElement $node) {
|
|
| 43 | 43 | |
| 44 | 44 | $array = array(); |
| 45 | 45 | $array['type'] = $node['type'] |
| 46 | 46 | ? (string)$node['type'] |
| 47 | 47 | : (string)$node->getName(); |
| 48 | 48 | $value = (string)$node; |
| 49 | - if($value != ''){
|
|
| 49 | + if ($value != '') {
|
|
| 50 | 50 | $array['value'] = $value; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - foreach($node->attributes() as $name=>$value){
|
|
| 53 | + foreach ($node->attributes() as $name=>$value) {
|
|
| 54 | 54 | $array[$name] = (string)$value; |
| 55 | 55 | } |
| 56 | - foreach($node->children() as $nr=>$child){
|
|
| 56 | + foreach ($node->children() as $nr=>$child) {
|
|
| 57 | 57 | $name = $child->getName(); |
| 58 | 58 | $res = self::doTranslate($child); |
| 59 | 59 | |
| 60 | - if(isset($array[$name])){
|
|
| 61 | - if(is_string($array[$name])){
|
|
| 60 | + if (isset($array[$name])) {
|
|
| 61 | + if (is_string($array[$name])) {
|
|
| 62 | 62 | $array[$name] = array( |
| 63 | 63 | array( |
| 64 | 64 | 'type'=>$name, |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | ) |
| 67 | 67 | ); |
| 68 | 68 | } |
| 69 | - }else{
|
|
| 69 | + }else {
|
|
| 70 | 70 | $array[$name] = array(); |
| 71 | 71 | } |
| 72 | 72 | $array[$name][] = $res; |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | Reflection_Pool::getInstance( |
| 68 | 68 | $object->getContent() |
| 69 | 69 | ) |
| 70 | - ), |
|
| 71 | - $object |
|
| 72 | - ); |
|
| 70 | + ), |
|
| 71 | + $object |
|
| 72 | + ); |
|
| 73 | 73 | }else{
|
| 74 | 74 | throw new \InvalidArgumentException('instance of \PEIP\INF\Event\Event must contain subject');
|
| 75 | 75 | } |
@@ -78,18 +78,18 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | } //put your code here |
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Creates an event-object with given object as content/subject and notifies |
|
| 83 | - * all registers listeners of the event. |
|
| 84 | - * |
|
| 85 | - * @access public |
|
| 86 | - * @param string $name name of the event |
|
| 87 | - * @param object $object the subject of the event |
|
| 88 | - * @param array $headers headers of the event-object as key/value pairs |
|
| 89 | - * @param string $eventClass event-class to create instances from |
|
| 90 | - * @return |
|
| 91 | - * @see EventBuilder |
|
| 92 | - */ |
|
| 81 | + /** |
|
| 82 | + * Creates an event-object with given object as content/subject and notifies |
|
| 83 | + * all registers listeners of the event. |
|
| 84 | + * |
|
| 85 | + * @access public |
|
| 86 | + * @param string $name name of the event |
|
| 87 | + * @param object $object the subject of the event |
|
| 88 | + * @param array $headers headers of the event-object as key/value pairs |
|
| 89 | + * @param string $eventClass event-class to create instances from |
|
| 90 | + * @return |
|
| 91 | + * @see EventBuilder |
|
| 92 | + */ |
|
| 93 | 93 | public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false){
|
| 94 | 94 | if(!$this->hasListeners($name, ($object))){
|
| 95 | 95 | return false; |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | * @param Callable|PEIP\INF\Handler\Handler $listener event-handler |
| 28 | 28 | * @return boolean |
| 29 | 29 | */ |
| 30 | - public function connect($name, $object, $listener){
|
|
| 30 | + public function connect($name, $object, $listener) {
|
|
| 31 | 31 | $class = is_object($object) ? get_class($object) : (string)$object; |
| 32 | - foreach(Reflection::getImplementedClassesAndInterfaces($object) as $cls){
|
|
| 32 | + foreach (Reflection::getImplementedClassesAndInterfaces($object) as $cls) {
|
|
| 33 | 33 | $reflection = Reflection_Pool::getInstance($class); |
| 34 | 34 | parent::connect($name, $reflection, $listener); |
| 35 | 35 | } |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | return true; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function disconnect($name, $object, $listener){
|
|
| 40 | + public function disconnect($name, $object, $listener) {
|
|
| 41 | 41 | $class = is_object($object) ? get_class($object) : (string)$object; |
| 42 | 42 | $res = true; |
| 43 | - foreach(Reflection::getImplementedClassesAndInterfaces($object) as $cls){
|
|
| 43 | + foreach (Reflection::getImplementedClassesAndInterfaces($object) as $cls) {
|
|
| 44 | 44 | $reflection = Reflection_Pool::getInstance($class); |
| 45 | 45 | $r = parent::disconnect($name, $reflection, $listener); |
| 46 | - if(!$r){
|
|
| 46 | + if (!$r) {
|
|
| 47 | 47 | $res = false; |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | * @param \PEIP\INF\Event\Event $object an event object |
| 59 | 59 | * @return boolean |
| 60 | 60 | */ |
| 61 | - public function notify($name, $object){
|
|
| 62 | - if($object instanceof \PEIP\INF\Event\Event){
|
|
| 63 | - if(is_object($object->getContent())){
|
|
| 61 | + public function notify($name, $object) {
|
|
| 62 | + if ($object instanceof \PEIP\INF\Event\Event) {
|
|
| 63 | + if (is_object($object->getContent())) {
|
|
| 64 | 64 | return self::doNotify( |
| 65 | 65 | $this->getListeners( |
| 66 | 66 | $name, |
@@ -70,10 +70,10 @@ discard block |
||
| 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 |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | * @return |
| 91 | 91 | * @see EventBuilder |
| 92 | 92 | */ |
| 93 | - public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false){
|
|
| 94 | - if(!$this->hasListeners($name, ($object))){
|
|
| 93 | + public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false) {
|
|
| 94 | + if (!$this->hasListeners($name, ($object))) {
|
|
| 95 | 95 | return false; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @param object $object object to check for listeners |
| 115 | 115 | * @return boolean |
| 116 | 116 | */ |
| 117 | - public function hasListeners($name, $object){
|
|
| 117 | + public function hasListeners($name, $object) {
|
|
| 118 | 118 | return parent::hasListeners( |
| 119 | 119 | $name, |
| 120 | 120 | Reflection_Pool::getInstance($object) |
@@ -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))){
|
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | * |
| 12 | 12 | * @author timo |
| 13 | 13 | */ |
| 14 | -use PEIP\Util\Reflection; |
|
| 14 | +use PEIP\Util\Reflection; |
|
| 15 | 15 | use PEIP\Event\EventBuilder; |
| 16 | 16 | |
| 17 | 17 | class ClassEventDispatcher extends \PEIP\Dispatcher\ObjectEventDispatcher {
|