| @@ 60-75 (lines=16) @@ | ||
| 57 | * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
| 58 | * @link http://datasift.github.io/storyplayer |
|
| 59 | */ |
|
| 60 | class BaseRedisConn extends Prose |
|
| 61 | { |
|
| 62 | public function __construct(StoryTeller $st, $args) |
|
| 63 | { |
|
| 64 | // call our parent first |
|
| 65 | parent::__construct($st, $args); |
|
| 66 | ||
| 67 | // make sure we have a Redis connection |
|
| 68 | if (!isset($args[0])) { |
|
| 69 | throw Exceptions::newActionFailedException(__METHOD__, "param #1 needs to be a valid Redis connection"); |
|
| 70 | } |
|
| 71 | if (!$args[0] instanceof PredisClient) { |
|
| 72 | throw Exceptions::newActionFailedException(__METHOD__, "param #1 needs to be an instance of Predis\\Client"); |
|
| 73 | } |
|
| 74 | } |
|
| 75 | } |
|
| 76 | ||
| @@ 65-79 (lines=15) @@ | ||
| 62 | * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
| 63 | * @link http://datasift.github.io/storyplayer |
|
| 64 | */ |
|
| 65 | class ZmqSocketBase extends Prose |
|
| 66 | { |
|
| 67 | static public $defaultTimeout = 5; |
|
| 68 | ||
| 69 | public function __construct(Storyteller $st, $params = []) |
|
| 70 | { |
|
| 71 | // call our parent first |
|
| 72 | parent::__construct($st, $params); |
|
| 73 | ||
| 74 | // make sure that we have a ZMQ socket |
|
| 75 | if (!isset($params[0]) || !$params[0] instanceof ZMQSocket) { |
|
| 76 | throw Exceptions::newActionFailedException(__METHOD__, "first param must be a ZMQ socket"); |
|
| 77 | } |
|
| 78 | } |
|
| 79 | } |
|
| 80 | ||