@@ -504,6 +504,8 @@ discard block |
||
| 504 | 504 | /** |
| 505 | 505 | * @override |
| 506 | 506 | * @inheritDoc |
| 507 | + * @param ProtocolInterface $message |
|
| 508 | + * @param integer $flags |
|
| 507 | 509 | */ |
| 508 | 510 | protected function handleSendAsync($name, $message, $flags = Channel::MODE_DEFAULT) |
| 509 | 511 | { |
@@ -522,6 +524,8 @@ discard block |
||
| 522 | 524 | /** |
| 523 | 525 | * @override |
| 524 | 526 | * @inheritDoc |
| 527 | + * @param ProtocolInterface $message |
|
| 528 | + * @param integer $flags |
|
| 525 | 529 | */ |
| 526 | 530 | protected function handlePushAsync($name, $message, $flags = Channel::MODE_DEFAULT) |
| 527 | 531 | { |
@@ -552,6 +556,8 @@ discard block |
||
| 552 | 556 | /** |
| 553 | 557 | * @override |
| 554 | 558 | * @inheritDoc |
| 559 | + * @param ProtocolInterface $message |
|
| 560 | + * @param integer $flags |
|
| 555 | 561 | */ |
| 556 | 562 | protected function handleSendRequest($name, $message, $flags = Channel::MODE_DEFAULT, callable $success = null, callable $failure = null, callable $cancel = null, $timeout = 0.0) |
| 557 | 563 | { |
@@ -570,6 +576,8 @@ discard block |
||
| 570 | 576 | /** |
| 571 | 577 | * @override |
| 572 | 578 | * @inheritDoc |
| 579 | + * @param ProtocolInterface $message |
|
| 580 | + * @param integer $flags |
|
| 573 | 581 | */ |
| 574 | 582 | protected function handlePushRequest($name, $message, $flags = Channel::MODE_DEFAULT, callable $success = null, callable $failure = null, callable $cancel = null, $timeout = 0.0) |
| 575 | 583 | { |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | |
| 432 | 432 | if ($this->handleReceiveResponse($protocol) || $this->getInput()->handle($sender, $protocol)) |
| 433 | 433 | { |
| 434 | - $this->emit('input', [ $sender, $protocol ]); |
|
| 434 | + $this->emit('input', [$sender, $protocol]); |
|
| 435 | 435 | } |
| 436 | 436 | } |
| 437 | 437 | |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | */ |
| 442 | 442 | public function pull($sender, ProtocolInterface $protocol) |
| 443 | 443 | { |
| 444 | - $this->emit('input', [ $sender, $protocol ]); |
|
| 444 | + $this->emit('input', [$sender, $protocol]); |
|
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | /** |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | if ($status) |
| 544 | 544 | { |
| 545 | 545 | $this->resolveOrRejectResponse($message->getPid(), $message->getException()); |
| 546 | - $this->emit('output', [ $name, $message ]); |
|
| 546 | + $this->emit('output', [$name, $message]); |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | return $status; |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | $request = $this->createRequest($pid, $success, $failure, $cancel, $timeout); |
| 603 | 603 | $this->addRequest($pid, $request); |
| 604 | 604 | |
| 605 | - $this->emit('output', [ $name, $message ]); |
|
| 605 | + $this->emit('output', [$name, $message]); |
|
| 606 | 606 | |
| 607 | 607 | return $request; |
| 608 | 608 | } |
@@ -674,11 +674,11 @@ discard block |
||
| 674 | 674 | } |
| 675 | 675 | else if ($exception === TaskIncompleteException::class) |
| 676 | 676 | { |
| 677 | - $this->cancelRequest($pid, new ThrowableProxy([ $exception, $message ])); |
|
| 677 | + $this->cancelRequest($pid, new ThrowableProxy([$exception, $message])); |
|
| 678 | 678 | } |
| 679 | 679 | else |
| 680 | 680 | { |
| 681 | - $this->rejectRequest($pid, new ThrowableProxy([ $exception, $message ])); |
|
| 681 | + $this->rejectRequest($pid, new ThrowableProxy([$exception, $message])); |
|
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | return true; |
@@ -785,8 +785,8 @@ discard block |
||
| 785 | 785 | */ |
| 786 | 786 | private function registerEvents() |
| 787 | 787 | { |
| 788 | - $this->handlers = $this->model->copyEvents($this, [ 'start', 'stop', 'connect', 'disconnect' ]); |
|
| 789 | - $this->handlers[] = $this->model->on('recv', [ $this, 'handleReceive' ]); |
|
| 788 | + $this->handlers = $this->model->copyEvents($this, ['start', 'stop', 'connect', 'disconnect']); |
|
| 789 | + $this->handlers[] = $this->model->on('recv', [$this, 'handleReceive']); |
|
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | /** |
@@ -577,13 +577,13 @@ discard block |
||
| 577 | 577 | |
| 578 | 578 | /** |
| 579 | 579 | * @param string $name |
| 580 | - * @param string|ProtocolInterface $message |
|
| 580 | + * @param ProtocolInterface $message |
|
| 581 | 581 | * @param int $flags |
| 582 | 582 | * @param callable|null $success |
| 583 | 583 | * @param callable|null $failure |
| 584 | 584 | * @param callable|null $cancel |
| 585 | 585 | * @param float $timeout |
| 586 | - * @return bool[] |
|
| 586 | + * @return boolean |
|
| 587 | 587 | */ |
| 588 | 588 | protected function handleSendRequest($name, $message, $flags = Channel::MODE_DEFAULT, callable $success = null, callable $failure = null, callable $cancel = null, $timeout = 0.0) |
| 589 | 589 | { |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | |
| 593 | 593 | /** |
| 594 | 594 | * @param string $name |
| 595 | - * @param string|ProtocolInterface $message |
|
| 595 | + * @param ProtocolInterface $message |
|
| 596 | 596 | * @param int $flags |
| 597 | 597 | * @param callable|null $success |
| 598 | 598 | * @param callable|null $failure |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | /** |
| 668 | - * @return int |
|
| 668 | + * @return string |
|
| 669 | 669 | */ |
| 670 | 670 | protected function getNextSuffix() |
| 671 | 671 | { |
@@ -124,8 +124,8 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $this->buses[$name] = $channel; |
| 127 | - $this->events[$name] = $channel->copyEvents($this, [ 'connect', 'disconnect' ]); |
|
| 128 | - $this->events[$name][] = $channel->on('input', [ $this, 'handleReceive' ]); |
|
| 127 | + $this->events[$name] = $channel->copyEvents($this, ['connect', 'disconnect']); |
|
| 128 | + $this->events[$name][] = $channel->on('input', [$this, 'handleReceive']); |
|
| 129 | 129 | |
| 130 | 130 | return $this; |
| 131 | 131 | } |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | { |
| 413 | 413 | if ($this->getInput()->handle($sender, $protocol)) |
| 414 | 414 | { |
| 415 | - $this->emit('input', [ $sender, $protocol ]); |
|
| 415 | + $this->emit('input', [$sender, $protocol]); |
|
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | 418 | |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | */ |
| 423 | 423 | public function pull($sender, ProtocolInterface $protocol) |
| 424 | 424 | { |
| 425 | - $this->emit('input', [ $sender, $protocol ]); |
|
| 425 | + $this->emit('input', [$sender, $protocol]); |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | /** |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | |
| 570 | 570 | if ($status) |
| 571 | 571 | { |
| 572 | - $this->emit('output', [ $name, $message ]); |
|
| 572 | + $this->emit('output', [$name, $message]); |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | return $status; |
@@ -632,7 +632,7 @@ discard block |
||
| 632 | 632 | |
| 633 | 633 | if ($status) |
| 634 | 634 | { |
| 635 | - $this->emit('output', [ $name, $message ]); |
|
| 635 | + $this->emit('output', [$name, $message]); |
|
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | return $status; |
@@ -240,13 +240,13 @@ |
||
| 240 | 240 | */ |
| 241 | 241 | public function setAll($args = [], $reassign = false) |
| 242 | 242 | { |
| 243 | - $this->type = isset($args[0]) && ($this->type === '' || $reassign) ? $args[0] : $this->type; |
|
| 244 | - $this->pid = isset($args[1]) && ($this->pid === '' || $reassign) ? $args[1] : $this->pid; |
|
| 245 | - $this->destination = isset($args[2]) && ($this->destination === '' || $reassign) ? $args[2] : $this->destination; |
|
| 246 | - $this->origin = isset($args[3]) && ($this->origin === '' || $reassign) ? $args[3] : $this->origin; |
|
| 247 | - $this->message = isset($args[4]) && ($this->message === '' || $reassign) ? $args[4] : $this->message; |
|
| 248 | - $this->exception = isset($args[5]) && ($this->exception === '' || $reassign) ? $args[5] : $this->exception; |
|
| 249 | - $this->timestamp = isset($args[6]) && ($this->timestamp == 0 || $reassign) ? $args[6] : $this->timestamp; |
|
| 243 | + $this->type = isset($args[0]) && ($this->type === '' || $reassign) ? $args[0] : $this->type; |
|
| 244 | + $this->pid = isset($args[1]) && ($this->pid === '' || $reassign) ? $args[1] : $this->pid; |
|
| 245 | + $this->destination = isset($args[2]) && ($this->destination === '' || $reassign) ? $args[2] : $this->destination; |
|
| 246 | + $this->origin = isset($args[3]) && ($this->origin === '' || $reassign) ? $args[3] : $this->origin; |
|
| 247 | + $this->message = isset($args[4]) && ($this->message === '' || $reassign) ? $args[4] : $this->message; |
|
| 248 | + $this->exception = isset($args[5]) && ($this->exception === '' || $reassign) ? $args[5] : $this->exception; |
|
| 249 | + $this->timestamp = isset($args[6]) && ($this->timestamp == 0 || $reassign) ? $args[6] : $this->timestamp; |
|
| 250 | 250 | |
| 251 | 251 | return $this; |
| 252 | 252 | } |
@@ -143,6 +143,6 @@ |
||
| 143 | 143 | */ |
| 144 | 144 | public function setPointer($stack, $pointer) |
| 145 | 145 | { |
| 146 | - $this->pointer = [ $stack, $pointer ]; |
|
| 146 | + $this->pointer = [$stack, $pointer]; |
|
| 147 | 147 | } |
| 148 | 148 | } |
@@ -5,4 +5,5 @@ |
||
| 5 | 5 | use Dazzle\Util\Factory\FactoryInterface; |
| 6 | 6 | |
| 7 | 7 | interface ChannelFactoryInterface extends FactoryInterface |
| 8 | -{} |
|
| 8 | +{ |
|
| 9 | +} |
|
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | $this->pid = $pid; |
| 46 | 46 | $this->success = ($success !== null) ? $success : function() {}; |
| 47 | 47 | $this->failure = ($failure !== null) ? $failure : function() {}; |
| 48 | - $this->cancel = ($cancel !== null) ? $cancel : function() {}; |
|
| 48 | + $this->cancel = ($cancel !== null) ? $cancel : function() {}; |
|
| 49 | 49 | $this->timeout = $timeout; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | ->define(Channel::class, function($model, $config = []) use($factory, $modelFactory) { |
| 38 | 38 | return new Channel( |
| 39 | 39 | isset($config['name']) ? $config['name'] : $factory->getParam('name'), |
| 40 | - $modelFactory->create($model, [ $config ]), |
|
| 40 | + $modelFactory->create($model, [$config]), |
|
| 41 | 41 | $factory->getParam('router'), |
| 42 | 42 | $factory->getParam('encoder'), |
| 43 | 43 | isset($config['loop']) ? $config['loop'] : $factory->getParam('loop') |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Dazzle\Channel\Model; |
| 4 | 4 | |
| 5 | -use Dazzle\Channel\Model\Null\NullModel; |
|
| 5 | +use Dazzle\Channel\Model\null\NullModel; |
|
| 6 | 6 | use Dazzle\Loop\LoopInterface; |
| 7 | 7 | use Dazzle\Util\Factory\Factory; |
| 8 | 8 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -namespace Dazzle\Channel\Model\Null; |
|
| 3 | +namespace Dazzle\Channel\Model\null; |
|
| 4 | 4 | |
| 5 | 5 | use Dazzle\Channel\Model\ModelInterface; |
| 6 | 6 | use Dazzle\Event\BaseEventEmitter; |