Changeset View
Changeset View
Standalone View
Standalone View
src/future/FutureProxy.php
| Show All 25 Lines | protected function getProxiedFuture() { | ||||
| return $this->proxied; | return $this->proxied; | ||||
| } | } | ||||
| public function isReady() { | public function isReady() { | ||||
| return $this->getProxiedFuture()->isReady(); | return $this->getProxiedFuture()->isReady(); | ||||
| } | } | ||||
| public function resolve() { | public function resolve() { | ||||
| $this->getProxiedFuture()->resolve(); | $result = $this->getProxiedFuture()->resolve(); | ||||
| $result = $this->didReceiveResult($result); | |||||
| $this->setResult($result); | |||||
| return $this->getResult(); | return $this->getResult(); | ||||
| } | } | ||||
| public function setException(Exception $ex) { | public function setException(Exception $ex) { | ||||
| $this->getProxiedFuture()->setException($ex); | $this->getProxiedFuture()->setException($ex); | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getException() { | public function getException() { | ||||
| return $this->getProxiedFuture()->getException(); | return $this->getProxiedFuture()->getException(); | ||||
| } | } | ||||
| public function getReadSockets() { | public function getReadSockets() { | ||||
| return $this->getProxiedFuture()->getReadSockets(); | return $this->getProxiedFuture()->getReadSockets(); | ||||
| } | } | ||||
| public function getWriteSockets() { | public function getWriteSockets() { | ||||
| return $this->getProxiedFuture()->getWriteSockets(); | return $this->getProxiedFuture()->getWriteSockets(); | ||||
| } | } | ||||
| protected function getResult() { | |||||
| if ($this->result === null) { | |||||
| $result = $this->getProxiedFuture()->resolve(); | |||||
| $result = $this->didReceiveResult($result); | |||||
| $this->result = $result; | |||||
| } | |||||
| return $this->result; | |||||
| } | |||||
| public function start() { | public function start() { | ||||
| $this->getProxiedFuture()->start(); | $this->getProxiedFuture()->start(); | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| abstract protected function didReceiveResult($result); | abstract protected function didReceiveResult($result); | ||||
| } | } | ||||