SupportedPhpVersion.php in Automatic Updates 8
File
src/ReadinessChecker/SupportedPhpVersion.php
View source
<?php
namespace Drupal\automatic_updates\ReadinessChecker;
use Composer\Semver\VersionParser;
abstract class SupportedPhpVersion implements ReadinessCheckerInterface {
public function run() {
$messages = [];
$parser = new VersionParser();
$unsupported_constraint = $this
->getUnsupportedVersionConstraint();
if ($unsupported_constraint
->matches($parser
->parseConstraints($this
->getPhpVersion()))) {
$messages[] = $this
->getMessage();
}
return $messages;
}
protected function getPhpVersion() {
return PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
}
protected abstract function getUnsupportedVersionConstraint();
protected abstract function getMessage();
}