Spatie\Backup\BackupDestination\BackupDestination::isReachable PHP Method

isReachable() public method

public isReachable ( ) : boolean
return boolean
    public function isReachable() : bool
    {
        if (is_null($this->disk)) {
            return false;
        }
        try {
            $this->disk->allFiles($this->backupName);
            return true;
        } catch (Exception $exception) {
            $this->connectionError = $exception;
            return false;
        }
    }

Usage Example

 public function isHealthy() : bool
 {
     if (!$this->backupDestination->isReachable()) {
         return false;
     }
     if ($this->usesTooMuchStorage()) {
         return false;
     }
     if ($this->newestBackupIsTooOld()) {
         return false;
     }
     return true;
 }