@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | * @param string $eventName name of the event to listen to |
| 39 | 39 | * @param \PEIP\INF\Event\Connectable $connectable instance of \PEIP\INF\Event\Connectable to listen to |
| 40 | 40 | */ |
| 41 | - protected function doListen($eventName, \PEIP\INF\Event\Connectable $connectable){
|
|
| 42 | - if(!$connectable->hasListener($eventName, $this)){
|
|
| 41 | + protected function doListen($eventName, \PEIP\INF\Event\Connectable $connectable) {
|
|
| 42 | + if (!$connectable->hasListener($eventName, $this)) {
|
|
| 43 | 43 | $connectable->connect($eventName, $this); |
| 44 | 44 | $this->connections[spl_object_hash($connectable)] = $connectable; |
| 45 | 45 | } |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | * @param string $eventName name of the event to unlisten |
| 53 | 53 | * @param \PEIP\INF\Event\Connectable $connectable instance of \PEIP\INF\Event\Connectable to unlisten to |
| 54 | 54 | */ |
| 55 | - protected function doUnlisten($eventName, \PEIP\INF\Event\Connectable $connectable){
|
|
| 56 | - if(!$connectable->hasListener($eventName, $this)){
|
|
| 55 | + protected function doUnlisten($eventName, \PEIP\INF\Event\Connectable $connectable) {
|
|
| 56 | + if (!$connectable->hasListener($eventName, $this)) {
|
|
| 57 | 57 | $connectable->disconnect($eventName, $this); |
| 58 | 58 | unset($this->connections[spl_object_hash($connectable)]); |
| 59 | 59 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @access public |
| 66 | 66 | * @return array array of \PEIP\INF\Event\Connectable instances |
| 67 | 67 | */ |
| 68 | - public function doGetConnected(){
|
|
| 68 | + public function doGetConnected() {
|
|
| 69 | 69 | return array_values($this->connections); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | * @param \PEIP\INF\Channel\Channel $outputChannel the outputs-channel |
| 38 | 38 | * @return |
| 39 | 39 | */ |
| 40 | - public function __construct(\PEIP\INF\Channel\Channel $inputChannel, \PEIP\INF\Channel\Channel $outputChannel = NULL){
|
|
| 40 | + public function __construct(\PEIP\INF\Channel\Channel $inputChannel, \PEIP\INF\Channel\Channel $outputChannel = NULL) {
|
|
| 41 | 41 | $this->setInputChannel($inputChannel); |
| 42 | - if(is_object($outputChannel)){
|
|
| 42 | + if (is_object($outputChannel)) {
|
|
| 43 | 43 | $this->setOutputChannel($outputChannel); |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @param \PEIP\INF\Message\Message $message message to transform content |
| 52 | 52 | * @return |
| 53 | 53 | */ |
| 54 | - public function doReply(\PEIP\INF\Message\Message $message){
|
|
| 54 | + public function doReply(\PEIP\INF\Message\Message $message) {
|
|
| 55 | 55 | $this->replyMessage($this->transform($message)); |
| 56 | 56 | } |
| 57 | 57 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @param \PEIP\INF\Message\Message $message |
| 63 | 63 | * @return mixed result of transforming the message |
| 64 | 64 | */ |
| 65 | - public function transform(\PEIP\INF\Message\Message $message){
|
|
| 65 | + public function transform(\PEIP\INF\Message\Message $message) {
|
|
| 66 | 66 | return $this->doTransform($message); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | * @param \PEIP\INF\Message\Message $message |
| 35 | 35 | * @return mixed result of transforming the message payload/content |
| 36 | 36 | */ |
| 37 | - protected function doTransform(\PEIP\INF\Message\Message $message){
|
|
| 37 | + protected function doTransform(\PEIP\INF\Message\Message $message) {
|
|
| 38 | 38 | return $this->transformContent($message->getContent()); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | 23 | |
| 24 | - class PollableChannel |
|
| 24 | + class PollableChannel |
|
| 25 | 25 | extends \PEIP\ABS\Channel\Channel |
| 26 | 26 | implements \PEIP\INF\Channel\PollableChannel {
|
| 27 | 27 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @param $message |
| 35 | 35 | * @return |
| 36 | 36 | */ |
| 37 | - protected function doSend(\PEIP\INF\Message\Message $message){
|
|
| 37 | + protected function doSend(\PEIP\INF\Message\Message $message) {
|
|
| 38 | 38 | $this->messages[] = $message; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -44,17 +44,17 @@ discard block |
||
| 44 | 44 | * @param $timeout |
| 45 | 45 | * @return |
| 46 | 46 | */ |
| 47 | - public function receive($timeout = -1){
|
|
| 47 | + public function receive($timeout = -1) {
|
|
| 48 | 48 | $message = NULL; |
| 49 | - if($timeout == 0){
|
|
| 49 | + if ($timeout == 0) {
|
|
| 50 | 50 | $message = $this->getMessage(); |
| 51 | - }elseif($timeout < 0){
|
|
| 52 | - while(!$message = $this->getMessage()){
|
|
| 51 | + }elseif ($timeout < 0) {
|
|
| 52 | + while (!$message = $this->getMessage()) {
|
|
| 53 | 53 | |
| 54 | 54 | } |
| 55 | - }else{
|
|
| 55 | + }else {
|
|
| 56 | 56 | $time = time() + $timeout; |
| 57 | - while(($time > time()) && !$message = $this->getMessage()){
|
|
| 57 | + while (($time > time()) && !$message = $this->getMessage()) {
|
|
| 58 | 58 | |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @access protected |
| 67 | 67 | * @return |
| 68 | 68 | */ |
| 69 | - protected function getMessage(){
|
|
| 69 | + protected function getMessage() {
|
|
| 70 | 70 | return array_shift($this->messages); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @access public |
| 76 | 76 | * @return |
| 77 | 77 | */ |
| 78 | - public function clear(){
|
|
| 78 | + public function clear() {
|
|
| 79 | 79 | $this->messages = array(); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | * @param $selector |
| 86 | 86 | * @return |
| 87 | 87 | */ |
| 88 | - public function purge(\PEIP\INF\Selector\MessageSelector $selector){
|
|
| 89 | - foreach($this->messages as $key=>$message){
|
|
| 90 | - if(!$selector->acceptMessage($message)){
|
|
| 88 | + public function purge(\PEIP\INF\Selector\MessageSelector $selector) {
|
|
| 89 | + foreach ($this->messages as $key=>$message) {
|
|
| 90 | + if (!$selector->acceptMessage($message)) {
|
|
| 91 | 91 | unset($this->messages[$key]); |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -48,11 +48,11 @@ |
||
| 48 | 48 | $message = NULL; |
| 49 | 49 | if($timeout == 0){
|
| 50 | 50 | $message = $this->getMessage(); |
| 51 | - }elseif($timeout < 0){
|
|
| 51 | + } elseif($timeout < 0){
|
|
| 52 | 52 | while(!$message = $this->getMessage()){
|
| 53 | 53 | |
| 54 | 54 | } |
| 55 | - }else{
|
|
| 55 | + } else{
|
|
| 56 | 56 | $time = time() + $timeout; |
| 57 | 57 | while(($time > time()) && !$message = $this->getMessage()){
|
| 58 | 58 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @param $name |
| 35 | 35 | * @return |
| 36 | 36 | */ |
| 37 | - public function __construct($name){
|
|
| 37 | + public function __construct($name) {
|
|
| 38 | 38 | $this->name = $name; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @access public |
| 43 | 43 | * @return string the channel�s name |
| 44 | 44 | */ |
| 45 | - public function getName(){
|
|
| 45 | + public function getName() {
|
|
| 46 | 46 | return $this->name; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @param integer $timeout |
| 53 | 53 | * @return |
| 54 | 54 | */ |
| 55 | - public function send(\PEIP\INF\Message\Message $message, $timeout = -1){
|
|
| 55 | + public function send(\PEIP\INF\Message\Message $message, $timeout = -1) {
|
|
| 56 | 56 | $this->doFireEvent('preSend', array('MESSAGE'=>$message));
|
| 57 | 57 | $sent = $this->doSend($message); |
| 58 | 58 | $this->doFireEvent('postSend', array(
|
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @access public |
| 41 | 41 | * @return |
| 42 | 42 | */ |
| 43 | - public function __invoke(){
|
|
| 43 | + public function __invoke() {
|
|
| 44 | 44 | return $this->execute(); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @access public |
| 52 | 52 | * @return |
| 53 | 53 | */ |
| 54 | - public function execute(){
|
|
| 54 | + public function execute() {
|
|
| 55 | 55 | return call_user_func_array($this->callable, $this->getParameters()); |
| 56 | 56 | } |
| 57 | 57 | |
@@ -47,18 +47,18 @@ |
||
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * Builds and modifies an arbitrary service/object instance from a config-obect. |
|
| 52 | - * |
|
| 53 | - * @see XMLContext::doBuild |
|
| 54 | - * @see XMLContext::modifyService |
|
| 55 | - * @implements \PEIP\INF\Context\Context |
|
| 56 | - * @access public |
|
| 57 | - * @param object $config configuration object to build a service instance from. |
|
| 58 | - * @param array $arguments arguments for the service constructor |
|
| 59 | - * @param string $defaultClass class to create instance for if none is set in config |
|
| 60 | - * @return object build and modified srvice instance |
|
| 61 | - */ |
|
| 50 | + /** |
|
| 51 | + * Builds and modifies an arbitrary service/object instance from a config-obect. |
|
| 52 | + * |
|
| 53 | + * @see XMLContext::doBuild |
|
| 54 | + * @see XMLContext::modifyService |
|
| 55 | + * @implements \PEIP\INF\Context\Context |
|
| 56 | + * @access public |
|
| 57 | + * @param object $config configuration object to build a service instance from. |
|
| 58 | + * @param array $arguments arguments for the service constructor |
|
| 59 | + * @param string $defaultClass class to create instance for if none is set in config |
|
| 60 | + * @return object build and modified srvice instance |
|
| 61 | + */ |
|
| 62 | 62 | public function buildAndModify($config, $arguments, $defaultClass = false){
|
| 63 | 63 | return ServiceFactory::buildAndModify($config, $arguments, $defaultClass); |
| 64 | 64 | } |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | * @param \PEIP\INF\Context\Context $context context instance to register the plugin with |
| 41 | 41 | * @return |
| 42 | 42 | */ |
| 43 | - public function init(\PEIP\INF\Context\Context $context){
|
|
| 43 | + public function init(\PEIP\INF\Context\Context $context) {
|
|
| 44 | 44 | $this->context = $context; |
| 45 | - foreach($this->builders as $node=>$method){
|
|
| 45 | + foreach ($this->builders as $node=>$method) {
|
|
| 46 | 46 | $context->registerNodeBuilder($node, array($this, $method)); |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * @param string $defaultClass class to create instance for if none is set in config |
| 60 | 60 | * @return object build and modified srvice instance |
| 61 | 61 | */ |
| 62 | - public function buildAndModify($config, $arguments, $defaultClass = false){
|
|
| 62 | + public function buildAndModify($config, $arguments, $defaultClass = false) {
|
|
| 63 | 63 | return ServiceFactory::buildAndModify($config, $arguments, $defaultClass); |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @param $connection |
| 38 | 38 | * @return |
| 39 | 39 | */ |
| 40 | - public function setConnection($connection){
|
|
| 40 | + public function setConnection($connection) {
|
|
| 41 | 41 | $this->connection = $connection; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * @access public |
| 48 | 48 | * @return |
| 49 | 49 | */ |
| 50 | - public function execute(){
|
|
| 50 | + public function execute() {
|
|
| 51 | 51 | return $this->send(); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * @access public |
| 57 | 57 | * @return |
| 58 | 58 | */ |
| 59 | - public function send(){
|
|
| 59 | + public function send() {
|
|
| 60 | 60 | return $this->connection->sendRequest($this); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @access public |
| 66 | 66 | * @return |
| 67 | 67 | */ |
| 68 | - public function getRequestData(){
|
|
| 68 | + public function getRequestData() {
|
|
| 69 | 69 | return $this->doGetRequestData(); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | * @param $request |
| 35 | 35 | * @return |
| 36 | 36 | */ |
| 37 | - public function sendRequest(\PEIP\ABS\Request\Request $request){
|
|
| 37 | + public function sendRequest(\PEIP\ABS\Request\Request $request) {
|
|
| 38 | 38 | return $this->doSendRequest($request); |
| 39 | 39 | } |
| 40 | 40 | |