@@ -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 |