mirror of
https://github.com/silverstripe/silverstripe-environmentcheck
synced 2024-10-22 17:05:40 +02:00
Merge pull request #104 from creative-commoners/pulls/3.0/remove-self
ENH Use class name instead of self
This commit is contained in:
commit
90a3b6d12d
@ -80,7 +80,7 @@ class FileAccessibilityAndValidationCheck implements EnvironmentCheck
|
|||||||
{
|
{
|
||||||
$this->path = $path;
|
$this->path = $path;
|
||||||
$this->fileTypeValidateFunc = ($fileTypeValidateFunc)? $fileTypeValidateFunc : 'noVidation';
|
$this->fileTypeValidateFunc = ($fileTypeValidateFunc)? $fileTypeValidateFunc : 'noVidation';
|
||||||
$this->checkType = ($checkType) ? $checkType : self::CHECK_SINGLE;
|
$this->checkType = ($checkType) ? $checkType : FileAccessibilityAndValidationCheck::CHECK_SINGLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -109,7 +109,9 @@ class FileAccessibilityAndValidationCheck implements EnvironmentCheck
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If at least one file was valid, count as passed
|
// If at least one file was valid, count as passed
|
||||||
if ($this->checkType == self::CHECK_SINGLE && count($invalidFiles ?? []) < count($files ?? [])) {
|
if ($this->checkType == FileAccessibilityAndValidationCheck::CHECK_SINGLE
|
||||||
|
&& count($invalidFiles ?? []) < count($files ?? [])
|
||||||
|
) {
|
||||||
$validFileList = PHP_EOL;
|
$validFileList = PHP_EOL;
|
||||||
foreach ($validFiles as $vf) {
|
foreach ($validFiles as $vf) {
|
||||||
$validFileList .= $vf . PHP_EOL;
|
$validFileList .= $vf . PHP_EOL;
|
||||||
|
@ -85,7 +85,7 @@ class FileAgeCheck implements EnvironmentCheck
|
|||||||
$this->path = $path;
|
$this->path = $path;
|
||||||
$this->relativeAge = $relativeAge;
|
$this->relativeAge = $relativeAge;
|
||||||
$this->checkFn = $checkFn;
|
$this->checkFn = $checkFn;
|
||||||
$this->checkType = ($checkType) ? $checkType : self::CHECK_SINGLE;
|
$this->checkType = ($checkType) ? $checkType : FileAgeCheck::CHECK_SINGLE;
|
||||||
$this->compareOperand = $compareOperand;
|
$this->compareOperand = $compareOperand;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ class FileAgeCheck implements EnvironmentCheck
|
|||||||
$validFiles[] = $file;
|
$validFiles[] = $file;
|
||||||
} else {
|
} else {
|
||||||
$invalidFiles[] = $file;
|
$invalidFiles[] = $file;
|
||||||
if ($this->checkType == self::CHECK_ALL) {
|
if ($this->checkType == FileAgeCheck::CHECK_ALL) {
|
||||||
return [
|
return [
|
||||||
EnvironmentCheck::ERROR,
|
EnvironmentCheck::ERROR,
|
||||||
sprintf(
|
sprintf(
|
||||||
@ -127,7 +127,7 @@ class FileAgeCheck implements EnvironmentCheck
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If at least one file was valid, count as passed
|
// If at least one file was valid, count as passed
|
||||||
if ($this->checkType == self::CHECK_SINGLE && count($invalidFiles ?? []) < count($files ?? [])) {
|
if ($this->checkType == FileAgeCheck::CHECK_SINGLE && count($invalidFiles ?? []) < count($files ?? [])) {
|
||||||
return [EnvironmentCheck::OK, ''];
|
return [EnvironmentCheck::OK, ''];
|
||||||
}
|
}
|
||||||
if (count($invalidFiles ?? []) == 0) {
|
if (count($invalidFiles ?? []) == 0) {
|
||||||
|
@ -74,7 +74,8 @@ class EnvironmentCheckSuite
|
|||||||
public function __construct($suiteName)
|
public function __construct($suiteName)
|
||||||
{
|
{
|
||||||
if (empty($this->config()->registered_suites[$suiteName])) {
|
if (empty($this->config()->registered_suites[$suiteName])) {
|
||||||
// Not registered via config system, but it still may be configured later via self::register.
|
// Not registered via config system, but it still may be configured later
|
||||||
|
// via EnvironmentCheckSuite::register.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,10 +182,10 @@ class EnvironmentCheckSuite
|
|||||||
*/
|
*/
|
||||||
public static function inst($name)
|
public static function inst($name)
|
||||||
{
|
{
|
||||||
if (!isset(self::$instances[$name])) {
|
if (!isset(EnvironmentCheckSuite::$instances[$name])) {
|
||||||
self::$instances[$name] = new EnvironmentCheckSuite($name);
|
EnvironmentCheckSuite::$instances[$name] = new EnvironmentCheckSuite($name);
|
||||||
}
|
}
|
||||||
return self::$instances[$name];
|
return EnvironmentCheckSuite::$instances[$name];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -201,7 +202,7 @@ class EnvironmentCheckSuite
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($names as $name) {
|
foreach ($names as $name) {
|
||||||
self::inst($name)->push($check, $title);
|
EnvironmentCheckSuite::inst($name)->push($check, $title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,6 +211,6 @@ class EnvironmentCheckSuite
|
|||||||
*/
|
*/
|
||||||
public static function reset()
|
public static function reset()
|
||||||
{
|
{
|
||||||
self::$instances = [];
|
EnvironmentCheckSuite::$instances = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user