src/Lib/MonitorHandler.php
public function handleChecks()
    {
        $errors = [];
        foreach ($this->_config['checks'] as $name => $check) {
            if (empty($check)) {
                continue;
            }
            $result = $check['callback']();
            if ($result !== true) {
               $errors[] = $name . ': <br>' . $check['error'] . ' - ' . $result;
            }
        }
        if (!empty($errors)) {

            $this->response->statusCode(500);

            echo date('Y-m-d H:i:s') . ': ' . $this->_config['projectName'] . ' - ' . $this->_config['serverDescription'] . ' - Status Code: ' . $this->response->statusCode() . '<br><br> ';
            foreach ($errors as $error) {
                echo $error . '<br><br>';
            }
            die;
        }
        $this->_config['onSuccess']();
        die;
    }
public function handleChecks()
    {
        $errors = [];
        foreach ($this->_config['checks'] as $name => $check) {
            if (empty($check)) {
                continue;
            }
            $result = $check['callback']();
            if ($result !== true) {
               $errors[] = $name . ': <br>' . $check['error'] . ' - ' . $result;
            }
        }
        if (!empty($errors)) {

            $this->response->statusCode(500);

            echo date('Y-m-d H:i:s') . ': ' . $this->_config['projectName'] . ' - ' . $this->_config['serverDescription'] . ' - Status Code: ' . $this->response->statusCode() . '<br><br> ';
            foreach ($errors as $error) {
                echo $error . '<br><br>';
            }
            die;
        }
        $this->_config['onSuccess']();
        die;
    }
public function handleChecks ( ) { $ errors = [ ] ; foreach ( $ this -> _config [ 'checks' ] as $ name => $ check ) { if ( empty ( $ check ) ) { continue ; } $ result = $ check [ 'callback' ] ( ) ; if ( $ result !== true ) { $ errors [ ] = $ name . ': <br>' . $ check [ 'error' ] . ' - ' . $ result ; } } if ( ! empty ( $ errors ) ) { $ this -> response -> statusCode ( 500 ) ; echo date ( 'Y-m-d H:i:s' ) . ': ' . $ this -> _config [ 'projectName' ] . ' - ' . $ this -> _config [ 'serverDescription' ] . ' - Status Code: ' . $ this -> response -> statusCode ( ) . '<br><br> ' ; foreach ( $ errors as $ error ) { echo $ error . '<br><br>' ; } die ; } $ this -> _config [ 'onSuccess' ] ( ) ; die ; }
Handle all defined checks

@return void
Handle all defined checks