@@ -7,12 +7,18 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | private $rule; |
| 9 | 9 | |
| 10 | + /** |
|
| 11 | + * @param string $key |
|
| 12 | + */ |
|
| 10 | 13 | static function verify_array( &$array, $key ) { |
| 11 | 14 | if ( ! isset( $array[ $key ] ) ) { |
| 12 | 15 | $array[ $key ] = array(); |
| 13 | 16 | } |
| 14 | 17 | } |
| 15 | 18 | |
| 19 | + /** |
|
| 20 | + * @param string $name |
|
| 21 | + */ |
|
| 16 | 22 | function __construct( $name ) { |
| 17 | 23 | $this->rule = array(); |
| 18 | 24 | self::$config[ $name ] = &$this->rule; |
@@ -30,6 +36,9 @@ discard block |
||
| 30 | 36 | return $this; |
| 31 | 37 | } |
| 32 | 38 | |
| 39 | + /** |
|
| 40 | + * @param string $capability |
|
| 41 | + */ |
|
| 33 | 42 | function user_can( $capability ) { |
| 34 | 43 | self::verify_array( $this->rule, 'caps' ); |
| 35 | 44 | |
@@ -46,6 +55,9 @@ discard block |
||
| 46 | 55 | return $this; |
| 47 | 56 | } |
| 48 | 57 | |
| 58 | + /** |
|
| 59 | + * @param string $plugin |
|
| 60 | + */ |
|
| 49 | 61 | function plugin_inactive( $plugin ) { |
| 50 | 62 | self::verify_array( $this->rule, 'inactive_plugins' ); |
| 51 | 63 | |
@@ -62,6 +74,9 @@ discard block |
||
| 62 | 74 | return $this; |
| 63 | 75 | } |
| 64 | 76 | |
| 77 | + /** |
|
| 78 | + * @param string $screen |
|
| 79 | + */ |
|
| 65 | 80 | function in_admin( $screen ) { |
| 66 | 81 | self::verify_array( $this->rule, 'message' ); |
| 67 | 82 | self::verify_array( $this->rule['message'], 'screens' ); |
@@ -71,6 +86,9 @@ discard block |
||
| 71 | 86 | return $this; |
| 72 | 87 | } |
| 73 | 88 | |
| 89 | + /** |
|
| 90 | + * @param string $hook |
|
| 91 | + */ |
|
| 74 | 92 | function with_CTA( $message, $hook ) { |
| 75 | 93 | self::verify_array( $this->rule, 'message' ); |
| 76 | 94 | |
@@ -90,6 +108,10 @@ discard block |
||
| 90 | 108 | return $this; |
| 91 | 109 | } |
| 92 | 110 | |
| 111 | + /** |
|
| 112 | + * @param string $group |
|
| 113 | + * @param string $detail |
|
| 114 | + */ |
|
| 93 | 115 | function track( $group, $detail ) { |
| 94 | 116 | $this->rule['tracker'] = array( |
| 95 | 117 | $group, |
@@ -99,6 +121,10 @@ discard block |
||
| 99 | 121 | return $this; |
| 100 | 122 | } |
| 101 | 123 | |
| 124 | + /** |
|
| 125 | + * @param string $key |
|
| 126 | + * @param integer $expected_value |
|
| 127 | + */ |
|
| 102 | 128 | function has_query_parameter( $key, $expected_value = null ) { |
| 103 | 129 | self::verify_array( $this->rule, 'has_query' ); |
| 104 | 130 | |