PHP code example of edisonlabs / policy-verification
1. Go to this page and download the library: Download edisonlabs/policy-verification library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
edisonlabs / policy-verification example snippets
// File: /src/EdisonLabs/PolicyVerification/PhpVersion.php
namespace EdisonLabs\PolicyVerification;
use EdisonLabs\PolicyVerification\Check\AbstractPolicyCheckBase;
class PhpVersion extends AbstractPolicyCheckBase
{
public function getName()
{
return 'PHP version';
}
public function getDescription()
{
return 'Checks whether system is running a recent version of PHP';
}
public function getCategory()
{
return 'PHP';
}
public function getSeverity()
{
return parent::POLICY_SEVERITY_HIGH;
}
public function checkRequirements()
{
// Example of
use EdisonLabs\PolicyVerification\Report;
// Some custom data to pass to the policy checks.
$data = array();
$report = new Report($data);
// Prints the result summary.
print_r($report->getResultSummary());
// Other report methods.
$report->getChecks();
$report->getPassChecks();
$report->getScorePercentage();
$report->setData($data);
$report->getData();
$report->getFailChecks();
$report->getActions();
$report->getPassChecksResultMessages();
$report->getFailChecksResultMessages();
$report->getRequirementErrors();
$report->getResult();
$report->getResultSummary();
$report->getScore();
$report->getTotalChecks();
$report->getWarnings();
$report->setCheck($check);
composer dump-autoload