Skip to content

Base interface and abstract level of the checker for health-checker

License

Notifications You must be signed in to change notification settings

tonicforhealth/health-checker-check

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Health-checker-check

License Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight

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();
}

About

Base interface and abstract level of the checker for health-checker

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages