condorrocks/condor

View on GitHub
app/CONDOR/Aspects/SSLCertificate/SSLCertificateChecker.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace App\Condor\Aspects\SSLCertificate;

use App\Condor\Checker;

class SSLCertificateChecker extends Checker
{
    public function status()
    {
        if ($this->checkExpired()) {
            return parent::STATUS_NOK;
        }

        return parent::STATUS_OK;
    }

    public function lookForIssues()
    {
        if ($this->checkExpired()) {
            $this->addIssue('SSL Certificate is expired');
        }

        return $this->issues();
    }

    protected function checkExpired()
    {
        return (int) $this->snapshot->data('expiresInDays') <= 0;
    }
}