Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Show file tree
Hide file tree
Showing 33 changed files with 604 additions and 710 deletions.
3 changes: 2 additions & 1 deletion composer.json
@@ -1,13 +1,14 @@
{
"name": "zendframework/zend-eventmanager",
"description": " ",
"license": "BSD-3-Clause",
"keywords": [
"zf2",
"eventmanager"
],
"autoload": {
"psr-4": {
"Zend\\EventManager": "src/"
"Zend\\EventManager\\": "src/"
}
},
"require": {
Expand Down
67 changes: 27 additions & 40 deletions src/Event.php
@@ -1,21 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_EventManager
*/

namespace Zend\EventManager;
Expand All @@ -25,13 +15,11 @@
/**
* Representation of an event
*
* Encapsulates the target context and parameters passed, and provides some
* Encapsulates the target context and parameters passed, and provides some
* behavior for interacting with the event manager.
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Event implements EventInterface
{
Expand Down Expand Up @@ -59,11 +47,10 @@ class Event implements EventInterface
* Constructor
*
* Accept a target and its parameters.
*
*
* @param string $name Event name
* @param string|object $target
* @param array|ArrayAccess $params
* @return void
* @param string|object $target
* @param array|ArrayAccess $params
*/
public function __construct($name = null, $target = null, $params = null)
{
Expand All @@ -82,7 +69,7 @@ public function __construct($name = null, $target = null, $params = null)

/**
* Get event name
*
*
* @return string
*/
public function getName()
Expand All @@ -94,7 +81,7 @@ public function getName()
* Get the event target
*
* This may be either an object, or the name of a static method.
*
*
* @return string|object
*/
public function getTarget()
Expand All @@ -106,8 +93,8 @@ public function getTarget()
* Set parameters
*
* Overwrites parameters
*
* @param array|ArrayAccess|object $params
*
* @param array|ArrayAccess|object $params
* @return Event
* @throws Exception\InvalidArgumentException
*/
Expand All @@ -125,7 +112,7 @@ public function setParams($params)

/**
* Get all parameters
*
*
* @return array|object|ArrayAccess
*/
public function getParams()
Expand All @@ -137,9 +124,9 @@ public function getParams()
* Get an individual parameter
*
* If the parameter does not exist, the $default value will be returned.
*
* @param string|int $name
* @param mixed $default
*
* @param string|int $name
* @param mixed $default
* @return mixed
*/
public function getParam($name, $default = null)
Expand All @@ -162,8 +149,8 @@ public function getParam($name, $default = null)

/**
* Set the event name
*
* @param string $name
*
* @param string $name
* @return Event
*/
public function setName($name)
Expand All @@ -174,8 +161,8 @@ public function setName($name)

/**
* Set the event target/context
*
* @param null|string|object $target
*
* @param null|string|object $target
* @return Event
*/
public function setTarget($target)
Expand All @@ -186,9 +173,9 @@ public function setTarget($target)

/**
* Set an individual parameter to a value
*
* @param string|int $name
* @param mixed $value
*
* @param string|int $name
* @param mixed $value
* @return Event
*/
public function setParam($name, $value)
Expand All @@ -205,8 +192,8 @@ public function setParam($name, $value)

/**
* Stop further event propagation
*
* @param bool $flag
*
* @param bool $flag
* @return void
*/
public function stopPropagation($flag = true)
Expand All @@ -216,7 +203,7 @@ public function stopPropagation($flag = true)

/**
* Is propagation stopped?
*
*
* @return bool
*/
public function propagationIsStopped()
Expand Down
56 changes: 22 additions & 34 deletions src/EventInterface.php
@@ -1,21 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_EventManager
*/

namespace Zend\EventManager;
Expand All @@ -27,85 +17,83 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface EventInterface
{
/**
* Get event name
*
*
* @return string
*/
public function getName();

/**
* Get target/context from which event was triggered
*
*
* @return null|string|object
*/
public function getTarget();

/**
* Get parameters passed to the event
*
*
* @return array|ArrayAccess
*/
public function getParams();

/**
* Get a single parameter by name
*
* @param string $name
*
* @param string $name
* @param mixed $default Default value to return if parameter does not exist
* @return mixed
*/
public function getParam($name, $default = null);

/**
* Set the event name
*
* @param string $name
*
* @param string $name
* @return void
*/
public function setName($name);

/**
* Set the event target/context
*
* @param null|string|object $target
*
* @param null|string|object $target
* @return void
*/
public function setTarget($target);

/**
* Set event parameters
*
* @param string $params
*
* @param string $params
* @return void
*/
public function setParams($params);

/**
* Set a single parameter by key
*
* @param string $name
* @param mixed $value
*
* @param string $name
* @param mixed $value
* @return void
*/
public function setParam($name, $value);

/**
* Indicate whether or not the parent EventManagerInterface should stop propagating events
*
* @param bool $flag
*
* @param bool $flag
* @return void
*/
public function stopPropagation($flag = true);

/**
* Has this event indicated event propagation should stop?
*
*
* @return bool
*/
public function propagationIsStopped();
Expand Down

0 comments on commit b1db52f

Please sign in to comment.