public function get()
    {
        // There are also resources available
        if (!$this->freeQueue->isEmpty()) {
            $res = $this->freeQueue->pop();

            // add to busy pool
            $this->busyQueue->attach($res);

            return $res;
        }

        // No available free resources, and the resource pool is full. waiting ...
        if (!$this->hasFree() && ($this->count() >= $this->maxSize)) {
            if ($this->waitTimeout === 0) {
                // return null;
                throw new \RuntimeException(
                    "Server busy, no resources available.(The pool has been overflow max value: {$this->maxSize})"
                );
            }

            $res = $this->wait();

            // No resources available, resource pool is not full
        } else {
            // create new resource
            $this->prepare($this->stepSize);
            $res = $this->freeQueue->pop();
        }

        // add to busy pool
        $this->busyQueue->attach($res);

        return $res;
    }
public function get()
    {
        // There are also resources available
        if (!$this->freeQueue->isEmpty()) {
            $res = $this->freeQueue->pop();

            // add to busy pool
            $this->busyQueue->attach($res);

            return $res;
        }

        // No available free resources, and the resource pool is full. waiting ...
        if (!$this->hasFree() && ($this->count() >= $this->maxSize)) {
            if ($this->waitTimeout === 0) {
                // return null;
                throw new \RuntimeException(
                    "Server busy, no resources available.(The pool has been overflow max value: {$this->maxSize})"
                );
            }

            $res = $this->wait();

            // No resources available, resource pool is not full
        } else {
            // create new resource
            $this->prepare($this->stepSize);
            $res = $this->freeQueue->pop();
        }

        // add to busy pool
        $this->busyQueue->attach($res);

        return $res;
    }
{@inheritdoc}
@return mixed
@throws \RuntimeException