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 / DocHooks.php

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

55 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * DocHooks 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 * DocHooks Checker class
15 */
16 class DocHooks extends Abstracts\Checker {
17
18 /**
19 * Checker name
20 *
21 * @var string
22 */
23 protected $name = 'dochooks';
24
25 /**
26 * Checks if the requirement is met
27 *
28 * @dochooks-test
29 *
30 * @since 1.0.0
31 * @throws \Exception When provided value is not a string or numeric.
32 * @param mixed $enabled If dochooks should be enabled or disabled.
33 * @return void
34 */
35 public function check( $enabled ) {
36
37 if ( ! is_bool( $enabled ) ) {
38 throw new \Exception( 'DocHooks Check requires bool parameter' );
39 }
40
41 $reflector = new \ReflectionClass( $this );
42 $has_comment = false !== strpos( $reflector->getMethod( 'check' )->getDocComment(), '@dochooks-test' );
43
44 if ( ! $has_comment && $enabled ) {
45 $this->add_error( __( 'Support for DocHooks is required. You need to disable OPCache comment stripping.', Requirements::$textdomain ) );
46 }
47
48 if ( $has_comment && ! $enabled ) {
49 $this->add_error( __( 'Support for DocHooks is superfluous', Requirements::$textdomain ) );
50 }
51
52 }
53
54 }
55