Finishes ConnectionPool
@return boolean Success
489374
public function finish($graceful = false)
    {
        $this->disable();

        if (!$this->finished) {
            $this->finished = true;
            $this->onFinish();
        }

        $result = true;

        foreach ($this as $conn) {
            if ($graceful) {
                if (!$conn->gracefulShutdown()) {
                    $result = false;
                }
            } else {
                $conn->finish();
            }
        }

        return $result;
    }
614659
private function clearConnectionPool()
    {
        $deleted = $this->connectionPool->removeInvalid();

        foreach ($deleted as $deletedid)
        {
            $this->emit('disconnect', [ $deletedid ]);
        }
    }
834075
function isConnected() {
		try {
			return $this->connection->isOpen();
		} catch (SmtpException $ex) {
			$this->log('EOF caught while checking if connected', 'client');
			$this->close();
		}
		return false;
	}
1231831
public function hasDataToRead()
    {
        if (!$this->isConnected()) {
            throw new ConnectionException('Not connected to any server.', $this->activeHost);
        }

        $isDataInBuffer = $this->connectionHasDataToRead($this->readTimeout[0], $this->readTimeout[1]);
        if (!$isDataInBuffer) {
            $this->observers->emptyBuffer();
        }
        return $isDataInBuffer;
    }
394948
public function finish() {
        $this->hr(1);
        $this->out('Admin installation complete!');
        $this->out('Please read the documentation for further instructions:');
        $this->out('http://milesj.me/code/cakephp/admin');
        $this->hr(1);

        return true;
    }
574366
public function close() : Promised
    {
        return
            ($this->pool
                ? $this->pool->shutdown()
                : (
                    $this->session
                        ? $this->session->close()
                        : Promise::resolved()
                )
            )->sync($this->closed())
        ;
    }
1363740
public function flush()
    {
        if (!$this->hasConnection()) {
            // @codeCoverageIgnoreStart
            return false;
            // @codeCoverageIgnoreEnd
        }

        try {
            return $this->memcache->flush();
            // @codeCoverageIgnoreStart
        } catch (\Exception $e) {
        }

        return false;
        // @codeCoverageIgnoreEnd
    }
939994
public function close()
    {
        if (!$this->connected) {
            return false;
        }

        $this->connected = false;
        fclose($this->socket);

        return true;
    }
196457
protected function end()
    {
        if ($this->matchChar(';')) {
            return true;
        }

        if ($this->count === strlen($this->buffer) || $this->buffer[$this->count] === '}') {
            // if there is end of file or a closing block next then we don't need a ;
            return true;
        }

        return false;
    }
756495
public function complete()
    {
        $stream = $this->content instanceof Stream ?
            $this->content
            : Psr7\stream_for($this->content);

        if ($this->rangeSize !== null) {
            $rangeSize = $this->rangeSize;
            $rangeSize = $rangeSize - $rangeSize % self::RANGE_SIZE_MULTIPLE;
            $rangeSize = min($rangeSize, self::MAX_RANGE_SIZE);
            $rangeSize = max($rangeSize, self::MIN_RANGE_SIZE);
        } else {
            $rangeSize = self::RANGE_SIZE_MULTIPLE;
        }

        $size   = $stream->getSize();
        $offset = 0;

        while (!$stream->eof()) {
            $rangeStream = new LimitStream($stream, $rangeSize, $offset);
            $rangeSize   = $rangeStream->getSize();
            $body        = $rangeStream->getContents();
            $rangeFirst  = $offset;
            $offset += $rangeSize;
            $rangeLast = $offset - 1;

            $headers = [
                'Content-Length' => $rangeSize,
                'Content-Range'  => "bytes $rangeFirst-$rangeLast/$size",
            ];

            if ($this->type !== null) {
                $headers['Content-Type'] = $this->type;
            }

            $response = $this
                ->graph
                ->createRequest('PUT', $this->uploadUrl)
                ->addHeaders($headers)
                ->attachBody($body)
                ->execute();

            $status = $response->getStatus();

            if ($status == 200 || $status == 201) {
                $driveItem = $response->getResponseAsObject(DriveItem::class);

                return new DriveItemProxy($this->graph, $driveItem);
            }

            if ($status != 202) {
                throw new \Exception("Unexpected status code produced by 'PUT {$this->uploadUrl}': $status");
            }
        }

        throw new \Exception('OneDrive did not create a drive item for the uploaded file');
    }
676209
private function complete()
    {
        if ($this->complete) {
            $message = "Iterator has already been completed";

            if (isset($this->resolutionTrace)) {
                $trace = formatStacktrace($this->resolutionTrace);
                $message .= ". Previous completion trace:\n\n{$trace}\n\n";
            } else {
                // @codeCoverageIgnoreStart
                $message .= ", define environment variable AMP_DEBUG or const AMP_DEBUG = true and enable assertions "
                    . "for a stacktrace of the previous resolution.";
                // @codeCoverageIgnoreEnd
            }

            throw new \Error($message);
        }

        \assert((function () {
            $env = \getenv("AMP_DEBUG") ?: "0";
            if (($env !== "0" && $env !== "false") || (\defined("AMP_DEBUG") && \AMP_DEBUG)) {
                $trace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS);
                \array_shift($trace); // remove current closure
                $this->resolutionTrace = $trace;
            }

            return true;
        })());

        $this->complete = new Success(false);

        if ($this->waiting !== null) {
            $waiting = $this->waiting;
            $this->waiting = null;
            $waiting->resolve($this->complete);
        }
    }
74037
function close()
    {
        $this->flush();
        $this->_opened = false;
        if ($this->_closeResource === true && is_resource($this->_stream)) {
            fclose($this->_stream);
        }
        return true;
    }
1300582
protected function finishQuery() {
        $this->query .= $this->closeOperation();

        if ($this->count) {
            $this->query = $this->getDriverEscaper()->dbCommand('SELECT') . ' ' .
                    'COUNT(*)' . ' ' .
                    $this->getDriverEscaper()->dbCommand('AS') . ' cpt ' .
                    $this->getDriverEscaper()->dbCommand('FROM') . ' ' .
                    '(' . $this->query . ') ' .
                    $this->getDriverEscaper()->dbCommand('AS') . ' rootq ';
        } else {
            $this->addSort($this->criteriaList->getSort());
            $this->query .= $this->operationSeparator . $this->addLimit($this->criteriaList->getLimit(), $this->criteriaList->getOffset());
        }

        $this->predicateLoop = 0;
        return $this;
    }
1177777
public function disconnect() {

        if(!$this->isConnected())
            return false;

        try {
            $this->connection->close();
        } catch (Exception $e){
            return false;
        }

        return true;
    }
220560
public function finish()
    {
        $this->xml_depth = 0;
        $this->current_ns = [];
        $this->idhandlers = [];
        $this->xpathhandlers = [];
        $this->eventHandlers = [];
    }
755988
public function stop()
    {
        if (!$this->started) {
            throw new Exception\ConnectionException('Client is not started');
        }

        if ($this->browserAutoruned) {
            $this->con->stop();
        }

        $this->started = false;
    }
949085
public function closeConnection() {
		if (is_resource($this->_dbh)) {
			$res = @oci_close($this->_dbh);
			$this->checkError($res);
		}
		else {
			$res = true;
		}

		return $res;
	}