| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace crmeb\utils;
- use Pheanstalk\Pheanstalk;
- /**
- * Beanstalkd client
- */
- class Beanstalk {
- protected static $inst;
- protected $talk;
- protected $config = [];
- protected function __construct()
- {
- $this->config = config('beanstalk');
- $this->talk = Pheanstalk::create($this->config['addr'], $this->config['port']);
- }
- public static function instance()
- {
- if (is_null(self::$inst)) {
- self::$inst = new static();
- }
- return self::$inst;
- }
- public static function __callStatic($name, $arguments)
- {
- return self::instance()->talk->{$name}(...$arguments);
- }
- }
|