Repo2\QueryReactor\Controller\PoolingController::getLink PHP Method

    public function getLink(Driver $driver, Query $query)
    {
        if (!$this->idle->isEmpty()) {
            return $this->idle->dequeue();
        }
        if ($this->pool->count() >= $this->params['max_connections']) {
            $this->waiting->enqueue($query);
            return false;
        }
        $link = $driver->connect($this->params, $this->params['username'], $this->params['passwd']);
        $this->pool->attach($link);
        return $link;
    }