Skouter mortgage estimates. Web application with view written in PHP and Vue, but controller and models in Go.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

PHPVersion.php 1.1 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace Grav\Plugin\Problems;
  3. use Grav\Plugin\Problems\Base\Problem;
  4. /**
  5. * Class PHPVersion
  6. * @package Grav\Plugin\Problems
  7. */
  8. class PHPVersion extends Problem
  9. {
  10. public function __construct()
  11. {
  12. $this->id = 'PHP Minimum Version';
  13. $this->class = get_class($this);
  14. $this->order = 102;
  15. $this->level = Problem::LEVEL_CRITICAL;
  16. $this->status = false;
  17. $this->help = 'https://getgrav.org/blog/raising-php-requirements-2018';
  18. }
  19. /**
  20. * @return $this
  21. */
  22. public function process()
  23. {
  24. $min_php_version = defined('GRAV_PHP_MIN') ? GRAV_PHP_MIN : '5.6.4';
  25. $your_php_version = PHP_VERSION;
  26. $msg = 'Your PHP <strong>%s</strong> is %s than the minimum of <strong>%s</strong> required';
  27. // Check PHP version
  28. if (version_compare($your_php_version, $min_php_version, '<')) {
  29. $this->msg = sprintf($msg, $your_php_version, 'less', $min_php_version);
  30. } else {
  31. $this->msg = sprintf($msg, $your_php_version, 'greater', $min_php_version);
  32. $this->status = true;
  33. }
  34. return $this;
  35. }
  36. }