X

Create New Item

File Folder

X

Search Results

File "ConnectivityCheckerThatCanFail.php"

Full path: /home/orbitecv/orbite-school.orbit.et/vendor/league/flysystem/src/Ftp/ConnectivityCheckerThatCanFail.php
File size: 645 B
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Edit   Back

<?php

declare(strict_types=1);

namespace League\Flysystem\Ftp;

class ConnectivityCheckerThatCanFail implements ConnectivityChecker
{
    private bool $failNextCall = false;

    public function __construct(private ConnectivityChecker $connectivityChecker)
    {
    }

    public function failNextCall(): void
    {
        $this->failNextCall = true;
    }

    /**
     * @inheritDoc
     */
    public function isConnected($connection): bool
    {
        if ($this->failNextCall) {
            $this->failNextCall = false;

            return false;
        }

        return $this->connectivityChecker->isConnected($connection);
    }
}