PHPDaemon\Clients\Redis\AutoScan::__construct PHP Method

__construct() public method

Constructor
public __construct ( Pool $pool, string $cmd, array $args = [], cllable $cbEnd = null, integer $limit = false )
$pool Pool Redis pool or connection
$cmd string Command
$args array Arguments
$cbEnd cllable Callback
$limit integer Limit
    public function __construct($pool, $cmd, $args = [], $cbEnd = null, $limit = false)
    {
        $this->conn = $pool;
        $this->cmd = $cmd;
        $this->args = empty($args) ? [] : $args;
        $this->limit = $limit;
        if (is_numeric($this->args[0])) {
            array_shift($this->args);
        }
        for ($i = sizeof($this->args) - 1; $i >= 0; --$i) {
            $a = $this->args[$i];
            if ((is_array($a) || is_object($a)) && is_callable($a)) {
                $this->cb = CallbackWrapper::wrap($a);
                $this->args = array_slice($this->args, 0, $i);
                break;
            } elseif ($a !== null) {
                break;
            }
        }
        if ($cbEnd !== null) {
            $this->cbEnd = CallbackWrapper::wrap($cbEnd);
        }
        $this->doIteration();
    }