PluginProbe
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO / 1.3.53
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO v1.3.53
1.4.17 1.4.16 1.4.15 1.4.14 1.4.13 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.54 1.3.53 1.3.52 1.3.51 1.3.50 1.3.49 1.3.48 All 180 releases
disco / vendor / micropackage / requirements / src / Checker / PHP.php

PHP.php in Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO 1.3.53, at vendor/micropackage/requirements/src/Checker/PHP.php

53 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * PHP Checker class
4 *
5 * @package micropackage/requirements
6 */
7
8 namespace Micropackage\Requirements\Checker;
9
10 use Micropackage\Requirements\Abstracts;
11 use Micropackage\Requirements\Requirements;
12
13 /**
14 * PHP Checker class
15 */
16 class PHP extends Abstracts\Checker {
17
18 /**
19 * Checker name
20 *
21 * @var string
22 */
23 protected $name = 'php';
24
25 /**
26 * Checks if the requirement is met
27 *
28 * @since 1.0.0
29 * @throws \Exception When provided value is not a string or numeric.
30 * @param string $value Required PHP version.
31 * @return void
32 */
33 public function check( $value ) {
34
35 if ( ! is_string( $value ) && ! is_numeric( $value ) ) {
36 throw new \Exception( 'PHP Check requires numeric or string parameter' );
37 }
38
39 $php_version = phpversion();
40
41 if ( version_compare( $php_version, $value, '<' ) ) {
42 $this->add_error( sprintf(
43 // Translators: 1. Required PHP version, 2. Used PHP version.
44 __( 'Minimum required version of PHP is %1$s. Your version is %2$s', Requirements::$textdomain ),
45 $value,
46 $php_version
47 ) );
48 }
49
50 }
51
52 }
53