tonicforhealth / health-checker-check
Base interface and abstract level of the checker for health-checker
Installs: 21 954
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
Requires (Dev)
- phpunit/phpunit: ^4.8|^5.3
This package is not auto-updated.
Last update: 2024-11-13 20:06:14 UTC
README
This is base interface and abstract level of the checker.
Installation using Composer
$ composer require tonicforhealth/health-checker-check
Requirements
- PHP 5.5 or higher
Usage
<?php use TonicHealthCheck\Check\AbstractCheck; class WeekendCheck extends AbstractCheck { const GROUP = 'date'; const COMPONENT = 'weekend'; const CHECK = 'weekend-date-check'; public function __construct($checkNode) { parent::__construct($checkNode); } /** * @throws giCheckException */ public function performCheck() { if ($this->isNotWeekend(date())) { throw new CheckException('Unfortunately weekend isn\'t today.'); } } protected function isNotWeekend($date) { return date('N', strtotime($date)) >= 6; } } $WeekendCheckI = new WeekendCheck('testnode'); $result = $WeekendCheckI->check(); if (!$result->isOk()) { echo $result->getError()->getMessage(); }