Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 12 commits
  • 10 files changed
  • 0 commit comments
  • 1 contributor
View
3 src/ABS/Channel/Channel.php
@@ -14,7 +14,8 @@
*
* @author Timo Michna <timomichna/yahoo.de>
* @package PEIP
- * @subpackage channel
+ * @subpackage channel
+ * @extends \PEIP\ABS\Base\Connectable
* @implements \PEIP\INF\Channel\Channel, \PEIP\INF\Event\Connectable
*/
View
2 src/ABS/Dispatcher/MapDispatcher.php
@@ -2,8 +2,6 @@
namespace PEIP\ABS\Dispatcher;
-namespace PEIP\ABS\Dispatcher;
-
/*
* This file is part of the PEIP package.
* (c) 2009-2011 Timo Michna <timomichna/yahoo.de>
View
2 src/ABS/Router/Router.php
@@ -2,8 +2,6 @@
namespace PEIP\ABS\Router;
-namespace PEIP\ABS\Router;
-
/*
* This file is part of the PEIP package.
* (c) 2009-2011 Timo Michna <timomichna/yahoo.de>
View
10 src/Dispatcher/Dispatcher.php
@@ -1,7 +1,5 @@
-<?php
-
-namespace PEIP\Dispatcher;
-
+<?php
+
namespace PEIP\Dispatcher;
/*
@@ -23,8 +21,8 @@
* @implements \PEIP\INF\Dispatcher\Dispatcher
*/
-use PEIP\Util\Test;
-
+use PEIP\Util\Test;
+
class Dispatcher
extends \PEIP\ABS\Dispatcher\Dispatcher
implements
View
2 src/Dispatcher/ObjectEventDispatcher.php
@@ -45,7 +45,7 @@ public function notify($name, $object){
return self::doNotify($this->getListeners($name, $object->getContent()), $object);
}
}else{
- throw new \InvalidArgumentException('instance of \PEIP\INF\Event\Event must contain subject');
+ throw new \InvalidArgumentException('instance of \PEIP\INF\Event\Event must contain object');
}
}else{
throw new \InvalidArgumentException('object must be instance of \PEIP\INF\Event\Event');
View
24 src/Dispatcher/ObjectMapDispatcher.php
@@ -2,8 +2,6 @@
namespace PEIP\Dispatcher;
-namespace PEIP\Dispatcher;
-
/*
* This file is part of the PEIP package.
* (c) 2009-2011 Timo Michna <timomichna/yahoo.de>
@@ -209,11 +207,7 @@ protected function doGetListeners(){
*/
protected static function doNotify(array $listeners, $subject){
foreach($listeners as $listener){
- if($listener instanceof \PEIP\INF\Handler\Handler){
- $listener->handle($subject);
- }elseif(is_callable($listener)){
- call_user_func($listener, $subject);
- }
+ self::doNotifyOne($listener, $subject);
}
}
@@ -229,11 +223,7 @@ protected static function doNotify(array $listeners, $subject){
protected static function doNotifyUntil(array $listeners, $subject){
$res = NULL;
foreach ($listeners as $listener){
- if($listener instanceof \PEIP\INF\Handler\Handler){
- $res = $listener->handle($subject);
- }elseif(is_callable($listener)){
- $res = call_user_func($listener, $subject);
- }
+ $res = self::doNotifyOne($listener, $subject);
if ($res){
return $res;
}
@@ -249,5 +239,15 @@ protected function getListenerHash($listener){
}
return spl_object_hash($listener);
}
+
+
+ protected static function doNotifyOne($listener, $subject){
+ if(is_callable($listener)){
+ $res = call_user_func($listener, $subject);
+ }else{
+ $res = $listener->handle($subject);
+ }
+ return $res;
+ }
}
View
26 src/INF/Queue/Queue.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace PEIP\INF\Queue;
+
+/*
+ * This file is part of the PEIP package.
+ * (c) 2009-2011 Timo Michna <timomichna/yahoo.de>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * \PEIP\INF\Queue\Queue
+ * Description of Queue
+ *
+ * @author Timo Michna <timomichna/yahoo.de>
+ * @package PEIP
+ */
+
+interface Queue {
+
+ public function enqueue($value);
+
+ public function dequeue();
+}
View
19 src/Plugins/BasePlugin.php
@@ -1,16 +1,25 @@
<?php
namespace PEIP\Plugins;
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+
+/*
+ * This file is part of the PEIP package.
+ * (c) 2009-2011 Timo Michna <timomichna/yahoo.de>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
*/
/**
- * Description of BasePlugin
+ * BasePlugin
+ * Plugin for Core Components
*
- * @author timo
+ * @author Timo Michna <timomichna/yahoo.de>
+ * @package PEIP
+ * @subpackage plugin
+ * @extends \PEIP\ABS\Context\ContextPlugin
*/
+
use PEIP\Context\XMLContext;
use PEIP\Channel\PollableChannel;
use PEIP\Channel\PublishSubscribeChannel;
View
25 src/Queue/Queue.php
@@ -0,0 +1,25 @@
+<?php
+
+namespace PEIP\Queue;
+
+/*
+ * This file is part of the PEIP package.
+ * (c) 2009-2011 Timo Michna <timomichna/yahoo.de>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Queue
+ * Description of Queue
+ *
+ * @author Timo Michna <timomichna/yahoo.de>
+ * @package PEIP
+ */
+
+class Queue
+ extends \SplQueue
+ implements PEIP\INF\Queue\Queue {
+
+}
View
13 tests/dispatcher/DispatcherTest.php
@@ -60,5 +60,16 @@ public function testNotifyUntil(){
$breaker = $this->dispatcher->notifyUntil($object);
$this->assertSame($listener2, $breaker);
}
-
+
+ public function testDisconnectAll(){
+ $listener = new PEIP_Callable_Handler(array('TestClass','TestMethod'));
+ $this->dispatcher->connect($listener);
+ $this->assertTrue($this->dispatcher->hasListeners());
+ $this->dispatcher->disconnectAll();
+ $this->assertFalse($this->dispatcher->hasListeners());
+
+ }
+
+
+
}

No commit comments for this range

Something went wrong with that request. Please try again.