Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dump the requirement checker #427

Merged
merged 1 commit into from
Jun 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .requirement-checker/bin/check-requirements.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace HumbugBox372\KevinGH\RequirementChecker;
namespace HumbugBox373\KevinGH\RequirementChecker;

require __DIR__ . '/../vendor/autoload.php';
if (\false === \in_array(\PHP_SAPI, array('cli', 'phpdbg', 'embed'), \true)) {
echo \PHP_EOL . 'The application may only be invoked from a command line, got "' . \PHP_SAPI . '"' . \PHP_EOL;
exit(1);
}
if ((\false === isset($_SERVER['BOX_REQUIREMENT_CHECKER']) || \true === (bool) $_SERVER['BOX_REQUIREMENT_CHECKER']) && \false === \HumbugBox372\KevinGH\RequirementChecker\Checker::checkRequirements()) {
if ((\false === isset($_SERVER['BOX_REQUIREMENT_CHECKER']) || \true === (bool) $_SERVER['BOX_REQUIREMENT_CHECKER']) && \false === \HumbugBox373\KevinGH\RequirementChecker\Checker::checkRequirements()) {
exit(1);
}
32 changes: 16 additions & 16 deletions .requirement-checker/src/Checker.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace HumbugBox372\KevinGH\RequirementChecker;
namespace HumbugBox373\KevinGH\RequirementChecker;

/**
@symfony
Expand All @@ -12,16 +12,16 @@ public static function checkRequirements()
{
$requirements = self::retrieveRequirements();
$checkPassed = $requirements->evaluateRequirements();
$io = new \HumbugBox372\KevinGH\RequirementChecker\IO();
self::printCheck($checkPassed, new \HumbugBox372\KevinGH\RequirementChecker\Printer($io->getVerbosity(), $io->hasColorSupport()), $requirements);
$io = new \HumbugBox373\KevinGH\RequirementChecker\IO();
self::printCheck($checkPassed, new \HumbugBox373\KevinGH\RequirementChecker\Printer($io->getVerbosity(), $io->hasColorSupport()), $requirements);
return $checkPassed;
}
public static function printCheck($checkPassed, \HumbugBox372\KevinGH\RequirementChecker\Printer $printer, \HumbugBox372\KevinGH\RequirementChecker\RequirementCollection $requirements)
public static function printCheck($checkPassed, \HumbugBox373\KevinGH\RequirementChecker\Printer $printer, \HumbugBox373\KevinGH\RequirementChecker\RequirementCollection $requirements)
{
if (\false === $checkPassed && \HumbugBox372\KevinGH\RequirementChecker\IO::VERBOSITY_VERY_VERBOSE > $printer->getVerbosity()) {
$printer->setVerbosity(\HumbugBox372\KevinGH\RequirementChecker\IO::VERBOSITY_VERY_VERBOSE);
if (\false === $checkPassed && \HumbugBox373\KevinGH\RequirementChecker\IO::VERBOSITY_VERY_VERBOSE > $printer->getVerbosity()) {
$printer->setVerbosity(\HumbugBox373\KevinGH\RequirementChecker\IO::VERBOSITY_VERY_VERBOSE);
}
$verbosity = \HumbugBox372\KevinGH\RequirementChecker\IO::VERBOSITY_VERY_VERBOSE;
$verbosity = \HumbugBox373\KevinGH\RequirementChecker\IO::VERBOSITY_VERY_VERBOSE;
$iniPath = $requirements->getPhpIniPath();
$printer->title('Box Requirements Checker', $verbosity);
$printer->printv('> Using PHP ', $verbosity);
Expand All @@ -42,24 +42,24 @@ public static function printCheck($checkPassed, \HumbugBox372\KevinGH\Requiremen
$errorMessages = array();
foreach ($requirements->getRequirements() as $requirement) {
if ($errorMessage = $printer->getRequirementErrorMessage($requirement)) {
if (\HumbugBox372\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG === $printer->getVerbosity()) {
$printer->printvln('✘ ' . $requirement->getTestMessage(), \HumbugBox372\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG, 'red');
$printer->printv(' ', \HumbugBox372\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG);
if (\HumbugBox373\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG === $printer->getVerbosity()) {
$printer->printvln('✘ ' . $requirement->getTestMessage(), \HumbugBox373\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG, 'red');
$printer->printv(' ', \HumbugBox373\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG);
$errorMessages[] = $errorMessage;
} else {
$printer->printv('E', $verbosity, 'red');
$errorMessages[] = $errorMessage;
}
continue;
}
if (\HumbugBox372\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG === $printer->getVerbosity()) {
$printer->printvln('✔ ' . $requirement->getHelpText(), \HumbugBox372\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG, 'green');
$printer->printv(' ', \HumbugBox372\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG);
if (\HumbugBox373\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG === $printer->getVerbosity()) {
$printer->printvln('✔ ' . $requirement->getHelpText(), \HumbugBox373\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG, 'green');
$printer->printv(' ', \HumbugBox373\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG);
} else {
$printer->printv('.', $verbosity, 'green');
}
}
if (\HumbugBox372\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG !== $printer->getVerbosity() && \count($requirements) > 0) {
if (\HumbugBox373\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG !== $printer->getVerbosity() && \count($requirements) > 0) {
$printer->printvln('', $verbosity);
}
if ($requirements->evaluateRequirements()) {
Expand All @@ -79,9 +79,9 @@ private static function retrieveRequirements()
self::$requirementsConfig = __DIR__ . '/../.requirements.php';
}
$config = (require self::$requirementsConfig);
$requirements = new \HumbugBox372\KevinGH\RequirementChecker\RequirementCollection();
$requirements = new \HumbugBox373\KevinGH\RequirementChecker\RequirementCollection();
foreach ($config as $constraint) {
$requirements->addRequirement('php' === $constraint['type'] ? new \HumbugBox372\KevinGH\RequirementChecker\IsPhpVersionFulfilled($constraint['condition']) : new \HumbugBox372\KevinGH\RequirementChecker\IsExtensionFulfilled($constraint['condition']), $constraint['message'], $constraint['helpMessage']);
$requirements->addRequirement('php' === $constraint['type'] ? new \HumbugBox373\KevinGH\RequirementChecker\IsPhpVersionFulfilled($constraint['condition']) : new \HumbugBox373\KevinGH\RequirementChecker\IsExtensionFulfilled($constraint['condition']), $constraint['message'], $constraint['helpMessage']);
}
return $requirements;
}
Expand Down
4 changes: 2 additions & 2 deletions .requirement-checker/src/IO.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace HumbugBox372\KevinGH\RequirementChecker;
namespace HumbugBox373\KevinGH\RequirementChecker;

final class IO
{
Expand Down Expand Up @@ -102,7 +102,7 @@ private function checkColorSupport()
return \false;
}
if (\DIRECTORY_SEPARATOR === '\\') {
return \function_exists('sapi_windows_vt100_support') && \sapi_windows_vt100_support(\STDOUT) || \false !== \getenv('ANSICON') || 'ON' === \getenv('ConEmuANSI') || 'xterm' === \getenv('TERM');
return \function_exists('sapi_windows_vt100_support') && sapi_windows_vt100_support(\STDOUT) || \false !== \getenv('ANSICON') || 'ON' === \getenv('ConEmuANSI') || 'xterm' === \getenv('TERM');
}
if (\function_exists('stream_isatty')) {
return \stream_isatty(\STDOUT);
Expand Down
4 changes: 2 additions & 2 deletions .requirement-checker/src/IsExtensionFulfilled.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace HumbugBox372\KevinGH\RequirementChecker;
namespace HumbugBox373\KevinGH\RequirementChecker;

final class IsExtensionFulfilled implements \HumbugBox372\KevinGH\RequirementChecker\IsFulfilled
final class IsExtensionFulfilled implements \HumbugBox373\KevinGH\RequirementChecker\IsFulfilled
{
private $requiredExtension;
public function __construct($requiredExtension)
Expand Down
2 changes: 1 addition & 1 deletion .requirement-checker/src/IsFulfilled.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace HumbugBox372\KevinGH\RequirementChecker;
namespace HumbugBox373\KevinGH\RequirementChecker;

interface IsFulfilled
{
Expand Down
8 changes: 4 additions & 4 deletions .requirement-checker/src/IsPhpVersionFulfilled.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace HumbugBox372\KevinGH\RequirementChecker;
namespace HumbugBox373\KevinGH\RequirementChecker;

use HumbugBox372\Composer\Semver\Semver;
final class IsPhpVersionFulfilled implements \HumbugBox372\KevinGH\RequirementChecker\IsFulfilled
use HumbugBox373\Composer\Semver\Semver;
final class IsPhpVersionFulfilled implements \HumbugBox373\KevinGH\RequirementChecker\IsFulfilled
{
private $requiredPhpVersion;
public function __construct($requiredPhpVersion)
Expand All @@ -12,6 +12,6 @@ public function __construct($requiredPhpVersion)
}
public function __invoke()
{
return \HumbugBox372\Composer\Semver\Semver::satisfies(\sprintf('%d.%d.%d', \PHP_MAJOR_VERSION, \PHP_MINOR_VERSION, \PHP_RELEASE_VERSION), $this->requiredPhpVersion);
return \HumbugBox373\Composer\Semver\Semver::satisfies(\sprintf('%d.%d.%d', \PHP_MAJOR_VERSION, \PHP_MINOR_VERSION, \PHP_RELEASE_VERSION), $this->requiredPhpVersion);
}
}
6 changes: 3 additions & 3 deletions .requirement-checker/src/Printer.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace HumbugBox372\KevinGH\RequirementChecker;
namespace HumbugBox373\KevinGH\RequirementChecker;

final class Printer
{
Expand All @@ -11,7 +11,7 @@ final class Printer
public function __construct($verbosity, $supportColors, $width = null)
{
if (null === $width) {
$terminal = new \HumbugBox372\KevinGH\RequirementChecker\Terminal();
$terminal = new \HumbugBox373\KevinGH\RequirementChecker\Terminal();
$width = \min($terminal->getWidth(), 80);
}
$this->verbosity = $verbosity;
Expand All @@ -36,7 +36,7 @@ public function title($title, $verbosity, $style = null)
$this->printvln(\str_repeat('=', \min(\strlen($title), $this->width)), $verbosity, $style);
$this->printvln('', $verbosity, $style);
}
public function getRequirementErrorMessage(\HumbugBox372\KevinGH\RequirementChecker\Requirement $requirement)
public function getRequirementErrorMessage(\HumbugBox373\KevinGH\RequirementChecker\Requirement $requirement)
{
if ($requirement->isFulfilled()) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion .requirement-checker/src/Requirement.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace HumbugBox372\KevinGH\RequirementChecker;
namespace HumbugBox373\KevinGH\RequirementChecker;

/**
@symfony
Expand Down
8 changes: 4 additions & 4 deletions .requirement-checker/src/RequirementCollection.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace HumbugBox372\KevinGH\RequirementChecker;
namespace HumbugBox373\KevinGH\RequirementChecker;

use ArrayIterator;
use Countable;
Expand All @@ -20,13 +20,13 @@ public function count()
{
return \count($this->requirements);
}
public function add(\HumbugBox372\KevinGH\RequirementChecker\Requirement $requirement)
public function add(\HumbugBox373\KevinGH\RequirementChecker\Requirement $requirement)
{
$this->requirements[] = $requirement;
}
public function addRequirement($checkIsFulfilled, $testMessage, $helpText)
{
$this->add(new \HumbugBox372\KevinGH\RequirementChecker\Requirement($checkIsFulfilled, $testMessage, $helpText));
$this->add(new \HumbugBox373\KevinGH\RequirementChecker\Requirement($checkIsFulfilled, $testMessage, $helpText));
}
public function getRequirements()
{
Expand All @@ -38,7 +38,7 @@ public function getPhpIniPath()
}
public function evaluateRequirements()
{
return \array_reduce($this->requirements, function ($checkPassed, \HumbugBox372\KevinGH\RequirementChecker\Requirement $requirement) {
return \array_reduce($this->requirements, function ($checkPassed, \HumbugBox373\KevinGH\RequirementChecker\Requirement $requirement) {
return $checkPassed && $requirement->isFulfilled();
}, \true);
}
Expand Down
2 changes: 1 addition & 1 deletion .requirement-checker/src/Terminal.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace HumbugBox372\KevinGH\RequirementChecker;
namespace HumbugBox373\KevinGH\RequirementChecker;

/**
@symfony
Expand Down
10 changes: 1 addition & 9 deletions .requirement-checker/vendor/autoload.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
<?php

// @generated by Humbug Box

// autoload.php @generated by Composer

require_once __DIR__ . '/composer/autoload_real.php';

$loader = ComposerAutoloaderInit8b58992d179d0afdbc92988c084b4eef::getLoader();

// Aliases for the whitelisted classes. For more information see:
// https://github.com/humbug/php-scoper/blob/master/README.md#class-whitelisting
class_exists('HumbugBox372\Composer\Semver\Semver');

return $loader;
return ComposerAutoloaderInitdbe7d0d11180973b81d79385e3b5d549::getLoader();
34 changes: 17 additions & 17 deletions .requirement-checker/vendor/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
$baseDir = dirname($vendorDir);

return array(
'HumbugBox372\\Composer\\Semver\\Comparator' => $vendorDir . '/composer/semver/src/Comparator.php',
'HumbugBox372\\Composer\\Semver\\Constraint\\AbstractConstraint' => $vendorDir . '/composer/semver/src/Constraint/AbstractConstraint.php',
'HumbugBox372\\Composer\\Semver\\Constraint\\Constraint' => $vendorDir . '/composer/semver/src/Constraint/Constraint.php',
'HumbugBox372\\Composer\\Semver\\Constraint\\ConstraintInterface' => $vendorDir . '/composer/semver/src/Constraint/ConstraintInterface.php',
'HumbugBox372\\Composer\\Semver\\Constraint\\EmptyConstraint' => $vendorDir . '/composer/semver/src/Constraint/EmptyConstraint.php',
'HumbugBox372\\Composer\\Semver\\Constraint\\MultiConstraint' => $vendorDir . '/composer/semver/src/Constraint/MultiConstraint.php',
'HumbugBox372\\Composer\\Semver\\Semver' => $vendorDir . '/composer/semver/src/Semver.php',
'HumbugBox372\\Composer\\Semver\\VersionParser' => $vendorDir . '/composer/semver/src/VersionParser.php',
'HumbugBox372\\KevinGH\\RequirementChecker\\Checker' => $baseDir . '/src/Checker.php',
'HumbugBox372\\KevinGH\\RequirementChecker\\IO' => $baseDir . '/src/IO.php',
'HumbugBox372\\KevinGH\\RequirementChecker\\IsExtensionFulfilled' => $baseDir . '/src/IsExtensionFulfilled.php',
'HumbugBox372\\KevinGH\\RequirementChecker\\IsFulfilled' => $baseDir . '/src/IsFulfilled.php',
'HumbugBox372\\KevinGH\\RequirementChecker\\IsPhpVersionFulfilled' => $baseDir . '/src/IsPhpVersionFulfilled.php',
'HumbugBox372\\KevinGH\\RequirementChecker\\Printer' => $baseDir . '/src/Printer.php',
'HumbugBox372\\KevinGH\\RequirementChecker\\Requirement' => $baseDir . '/src/Requirement.php',
'HumbugBox372\\KevinGH\\RequirementChecker\\RequirementCollection' => $baseDir . '/src/RequirementCollection.php',
'HumbugBox372\\KevinGH\\RequirementChecker\\Terminal' => $baseDir . '/src/Terminal.php',
'HumbugBox373\\Composer\\Semver\\Comparator' => $vendorDir . '/composer/semver/src/Comparator.php',
'HumbugBox373\\Composer\\Semver\\Constraint\\AbstractConstraint' => $vendorDir . '/composer/semver/src/Constraint/AbstractConstraint.php',
'HumbugBox373\\Composer\\Semver\\Constraint\\Constraint' => $vendorDir . '/composer/semver/src/Constraint/Constraint.php',
'HumbugBox373\\Composer\\Semver\\Constraint\\ConstraintInterface' => $vendorDir . '/composer/semver/src/Constraint/ConstraintInterface.php',
'HumbugBox373\\Composer\\Semver\\Constraint\\EmptyConstraint' => $vendorDir . '/composer/semver/src/Constraint/EmptyConstraint.php',
'HumbugBox373\\Composer\\Semver\\Constraint\\MultiConstraint' => $vendorDir . '/composer/semver/src/Constraint/MultiConstraint.php',
'HumbugBox373\\Composer\\Semver\\Semver' => $vendorDir . '/composer/semver/src/Semver.php',
'HumbugBox373\\Composer\\Semver\\VersionParser' => $vendorDir . '/composer/semver/src/VersionParser.php',
'HumbugBox373\\KevinGH\\RequirementChecker\\Checker' => $baseDir . '/src/Checker.php',
'HumbugBox373\\KevinGH\\RequirementChecker\\IO' => $baseDir . '/src/IO.php',
'HumbugBox373\\KevinGH\\RequirementChecker\\IsExtensionFulfilled' => $baseDir . '/src/IsExtensionFulfilled.php',
'HumbugBox373\\KevinGH\\RequirementChecker\\IsFulfilled' => $baseDir . '/src/IsFulfilled.php',
'HumbugBox373\\KevinGH\\RequirementChecker\\IsPhpVersionFulfilled' => $baseDir . '/src/IsPhpVersionFulfilled.php',
'HumbugBox373\\KevinGH\\RequirementChecker\\Printer' => $baseDir . '/src/Printer.php',
'HumbugBox373\\KevinGH\\RequirementChecker\\Requirement' => $baseDir . '/src/Requirement.php',
'HumbugBox373\\KevinGH\\RequirementChecker\\RequirementCollection' => $baseDir . '/src/RequirementCollection.php',
'HumbugBox373\\KevinGH\\RequirementChecker\\Terminal' => $baseDir . '/src/Terminal.php',
);
4 changes: 2 additions & 2 deletions .requirement-checker/vendor/composer/autoload_psr4.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
$baseDir = dirname($vendorDir);

return array(
'HumbugBox372\\KevinGH\\RequirementChecker\\' => array($baseDir . '/src'),
'HumbugBox372\\Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
'HumbugBox373\\KevinGH\\RequirementChecker\\' => array($baseDir . '/src'),
'HumbugBox373\\Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
);
8 changes: 4 additions & 4 deletions .requirement-checker/vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit8b58992d179d0afdbc92988c084b4eef
class ComposerAutoloaderInitdbe7d0d11180973b81d79385e3b5d549
{
private static $loader;

Expand All @@ -19,15 +19,15 @@ public static function getLoader()
return self::$loader;
}

spl_autoload_register(array('ComposerAutoloaderInit8b58992d179d0afdbc92988c084b4eef', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitdbe7d0d11180973b81d79385e3b5d549', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit8b58992d179d0afdbc92988c084b4eef', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitdbe7d0d11180973b81d79385e3b5d549', 'loadClassLoader'));

$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';

call_user_func(\Composer\Autoload\ComposerStaticInit8b58992d179d0afdbc92988c084b4eef::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitdbe7d0d11180973b81d79385e3b5d549::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
Expand Down
Loading