EricMakesStuff\ServerMonitor\Exceptions\InvalidPath::pathDoesNotExist PHP Method

pathDoesNotExist() public static method

public static pathDoesNotExist ( $path ) : InvalidPath
$path
return InvalidPath
    public static function pathDoesNotExist($path)
    {
        return new static("This path does not exist: `{$path}`");
    }

Usage Example

 /**
  * @throws InvalidPath
  */
 public function runMonitor()
 {
     if (!file_exists($this->path)) {
         throw InvalidPath::pathDoesNotExist($this->path);
     }
     $this->totalSpace = disk_total_space($this->path);
     $this->freeSpace = disk_free_space($this->path);
     $this->usedSpace = $this->totalSpace - $this->freeSpace;
     $this->percentageUsed = sprintf('%.2f', $this->usedSpace / $this->totalSpace * 100);
     if ($this->percentageUsed >= $this->alarmPercentage) {
         event(new DiskUsageAlarm($this));
     } else {
         event(new DiskUsageHealthy($this));
     }
 }