public function checkPhpVersion($version)
{
// this handles Any version of PHP
if ($this->phpVersion === self::PHP_VERSION_ANY) {
return true;
}
// version and above
if (substr($this->phpVersion, -1) === '+' && version_compare($version, $this->phpVersion) >= 0) {
return true;
}
// up to version
if (substr($this->phpVersion, -1) === '-' && version_compare($version, $this->phpVersion) < 0) {
return true;
}
// version range 1.2.3-4.5.6
if (strpos($this->phpVersion, '-') !== false) {
list($lower, $upper) = explode('-', $this->phpVersion);
if (version_compare($version, $lower) >= 0 && version_compare($version, $upper) <= 0) {
return true;
} else {
return false;
}
}
// One version only
if (version_compare($version, $this->phpVersion) == 0) {
return true;
}
// Default behavior if we don't understand :
return false;
}