Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev: changed interface to work with pluginevent object and optional t…
…arget pluginname for dispatch method
- Loading branch information
1 parent
4596d2b
commit 98aaebf
Showing
5 changed files
with
102 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
class PluginEvent | ||
{ | ||
protected $_event = ''; | ||
|
||
protected $_sender; | ||
|
||
protected $_stop = false; | ||
|
||
protected $_parameters = array(); | ||
|
||
/** | ||
* | ||
* @param string $event | ||
* @param objeect $sender | ||
* @return \PluginEvent | ||
*/ | ||
public function __construct($event, $sender = null) | ||
{ | ||
if (!is_null($sender) && is_object($sender)) | ||
{ | ||
$this->_sender = $sender; | ||
} | ||
|
||
$this->_event = $event; | ||
|
||
return $this; | ||
} | ||
|
||
public function get($key, $default = null) | ||
{ | ||
if (!array_key_exists($key, $this->_parameters)) | ||
{ | ||
return $default; | ||
} else { | ||
return $this->_parameters[$key]; | ||
} | ||
} | ||
|
||
public function getEventName() | ||
{ | ||
return $this->_event; | ||
} | ||
|
||
public function getSender() | ||
{ | ||
if (!is_null($this->_sender)) { | ||
return $this->_sender; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
public function set($key, $value) | ||
{ | ||
$this->_parameters[$key] = $value; | ||
|
||
return $this; | ||
} | ||
|
||
public function stop($bool = null) | ||
{ | ||
if (!is_null($bool)) { | ||
$this->_stop = (bool) $bool; | ||
} | ||
|
||
return (bool) $this->_stop; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters