Completed
Push — master ( 2bd2c3...b43b5b )
by J.D.
03:07
created
src/includes/classes/hook/condition.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,33 +23,33 @@  discard block
 block discarded – undo
23 23
 		WordPoints_Hook_Reaction_Validator $validator
24 24
 	) {
25 25
 
26
-		if ( ! isset( $settings['value'] ) || '' === $settings['value'] ) {
26
+		if ( ! isset($settings['value']) || '' === $settings['value']) {
27 27
 
28 28
 			$settings_fields = $this->get_settings_fields();
29 29
 
30 30
 			$validator->add_error(
31 31
 				sprintf(
32
-					__( '%s is required.', 'wordpoints' )
32
+					__('%s is required.', 'wordpoints')
33 33
 					, $settings_fields['value']['label']
34 34
 				)
35 35
 				, 'value'
36 36
 			);
37 37
 
38
-		} elseif ( $arg instanceof WordPoints_Entity_Attr ) {
38
+		} elseif ($arg instanceof WordPoints_Entity_Attr) {
39 39
 
40 40
 			$data_types = wordpoints_apps()->data_types;
41 41
 
42
-			$data_type = $data_types->get( $arg->get_data_type() );
42
+			$data_type = $data_types->get($arg->get_data_type());
43 43
 
44 44
 			// If this data type isn't recognized, that's probably OK. Validation is
45 45
 			// just to help the user know that they've made a mistake anyway.
46
-			if ( ! ( $data_type instanceof WordPoints_Data_TypeI ) ) {
46
+			if ( ! ($data_type instanceof WordPoints_Data_TypeI)) {
47 47
 				return $settings;
48 48
 			}
49 49
 
50
-			$validated_value = $data_type->validate_value( $settings['value'] );
50
+			$validated_value = $data_type->validate_value($settings['value']);
51 51
 
52
-			if ( is_wp_error( $validated_value ) ) {
52
+			if (is_wp_error($validated_value)) {
53 53
 
54 54
 				$settings_fields = $this->get_settings_fields();
55 55
 
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
 
67 67
 			$settings['value'] = $validated_value;
68 68
 
69
-		} elseif ( $arg instanceof WordPoints_Entity ) {
69
+		} elseif ($arg instanceof WordPoints_Entity) {
70 70
 
71
-			if ( ! $arg->exists( $settings['value'] ) ) {
71
+			if ( ! $arg->exists($settings['value'])) {
72 72
 				$validator->add_error(
73 73
 					sprintf(
74 74
 						// translators: 1. item type, 2. item ID/slug.
75
-						__( '%1$s “%2$s” not found.', 'wordpoints' )
75
+						__('%1$s “%2$s” not found.', 'wordpoints')
76 76
 						, $arg->get_title()
77 77
 						, $settings['value']
78 78
 					)
Please login to merge, or discard this patch.
src/includes/classes/hook/condition/equals.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @since 1.0.0
19 19
 	 */
20 20
 	public function get_title() {
21
-		return __( 'Equals', 'wordpoints' );
21
+		return __('Equals', 'wordpoints');
22 22
 	}
23 23
 
24 24
 	/**
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		return array(
30 30
 			'value' => array(
31 31
 				'type' => 'text',
32
-				'label' => __( 'Equals', 'wordpoints' ), // TODO
32
+				'label' => __('Equals', 'wordpoints'), // TODO
33 33
 			),
34 34
 		);
35 35
 	}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	/**
38 38
 	 * @since 1.0.0
39 39
 	 */
40
-	public function is_met( array $settings, WordPoints_Hook_Event_Args $args ) {
40
+	public function is_met(array $settings, WordPoints_Hook_Event_Args $args) {
41 41
 
42 42
 		return $settings['value'] === $args->get_current()->get_the_value();
43 43
 	}
Please login to merge, or discard this patch.
src/includes/classes/hook/condition/string/contains.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @since 1.0.0
19 19
 	 */
20 20
 	public function get_title() {
21
-		return __( 'Contains', 'wordpoints' );
21
+		return __('Contains', 'wordpoints');
22 22
 	}
23 23
 
24 24
 	/**
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 		return array(
29 29
 			'value' => array(
30 30
 				'type'     => 'text',
31
-				'label'    => __( 'Contains', 'wordpoints' ), // TODO
31
+				'label'    => __('Contains', 'wordpoints'), // TODO
32 32
 				'required' => true,
33 33
 			),
34 34
 		);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	/**
38 38
 	 * @since 1.0.0
39 39
 	 */
40
-	public function is_met( array $settings, WordPoints_Hook_Event_Args $args ) {
40
+	public function is_met(array $settings, WordPoints_Hook_Event_Args $args) {
41 41
 
42 42
 		return false !== strpos(
43 43
 			$args->get_current()->get_the_value()
Please login to merge, or discard this patch.
src/includes/classes/hook/conditioni.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
 	 *
65 65
 	 * @return bool Whether this condition is met.
66 66
 	 */
67
-	public function is_met( array $settings, WordPoints_Hook_Event_Args $args );
67
+	public function is_met(array $settings, WordPoints_Hook_Event_Args $args);
68 68
 }
69 69
 
70 70
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/hook/event.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 	/**
27 27
 	 * @since 1.0.0
28 28
 	 */
29
-	public function __construct( $slug ) {
29
+	public function __construct($slug) {
30 30
 
31 31
 		$this->slug = $slug;
32 32
 	}
Please login to merge, or discard this patch.
src/includes/classes/hook/event/user/register.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@
 block discarded – undo
18 18
 	 * @since 1.0.0
19 19
 	 */
20 20
 	public function get_title() {
21
-		return __( 'Register', 'wordpoints' );
21
+		return __('Register', 'wordpoints');
22 22
 	}
23 23
 
24 24
 	/**
25 25
 	 * @since 1.0.0
26 26
 	 */
27 27
 	public function get_description() {
28
-		return __( 'Registering.', 'wordpoints' );
28
+		return __('Registering.', 'wordpoints');
29 29
 	}
30 30
 }
31 31
 
Please login to merge, or discard this patch.
src/includes/classes/hook/event/user/visit.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@
 block discarded – undo
18 18
 	 * @since 1.0.0
19 19
 	 */
20 20
 	public function get_title() {
21
-		return __( 'Visit', 'wordpoints' );
21
+		return __('Visit', 'wordpoints');
22 22
 	}
23 23
 
24 24
 	/**
25 25
 	 * @since 1.0.0
26 26
 	 */
27 27
 	public function get_description() {
28
-		return __( 'When a logged-in user or guest visits the site.', 'wordpoints' );
28
+		return __('When a logged-in user or guest visits the site.', 'wordpoints');
29 29
 	}
30 30
 }
31 31
 
Please login to merge, or discard this patch.
src/includes/classes/hook/eventi.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 	/**
18 18
 	 * @param string $slug The event slug.
19 19
 	 */
20
-	public function __construct( $slug );
20
+	public function __construct($slug);
21 21
 
22 22
 	/**
23 23
 	 * Get the event slug.
Please login to merge, or discard this patch.
src/includes/classes/hook/events.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 	/**
38 38
 	 * @since 1.0.0
39 39
 	 */
40
-	public function __construct( $slug ) {
40
+	public function __construct($slug) {
41 41
 
42 42
 		$hooks = wordpoints_hooks();
43 43
 
44 44
 		$this->router = $hooks->router;
45 45
 
46
-		parent::__construct( $slug );
46
+		parent::__construct($slug);
47 47
 	}
48 48
 
49 49
 	/**
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function init() {
53 53
 
54
-		$this->sub_apps->register( 'args', 'WordPoints_Class_Registry_Children' );
54
+		$this->sub_apps->register('args', 'WordPoints_Class_Registry_Children');
55 55
 
56 56
 		parent::init();
57 57
 	}
@@ -75,29 +75,29 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @return bool Whether the event was registered.
77 77
 	 */
78
-	public function register( $slug, $class, array $args = array() ) {
78
+	public function register($slug, $class, array $args = array()) {
79 79
 
80 80
 		// TODO shoudl this be required?
81
-		if ( ! isset( $args['actions'] ) ) {
81
+		if ( ! isset($args['actions'])) {
82 82
 			return false;
83 83
 		}
84 84
 
85
-		parent::register( $slug, $class, $args );
85
+		parent::register($slug, $class, $args);
86 86
 
87
-		foreach ( $args['actions'] as $type => $actions ) {
88
-			foreach ( (array) $actions as $action_slug ) {
89
-				$this->router->add_event_to_action( $slug, $action_slug, $type );
87
+		foreach ($args['actions'] as $type => $actions) {
88
+			foreach ((array) $actions as $action_slug) {
89
+				$this->router->add_event_to_action($slug, $action_slug, $type);
90 90
 			}
91 91
 		}
92 92
 
93 93
 		// TODO should this be required?
94
-		if ( isset( $args['args'] ) ) {
95
-			foreach ( $args['args'] as $arg_slug => $class ) {
96
-				$this->args->register( $slug, $arg_slug, $class );
94
+		if (isset($args['args'])) {
95
+			foreach ($args['args'] as $arg_slug => $class) {
96
+				$this->args->register($slug, $arg_slug, $class);
97 97
 			}
98 98
 		}
99 99
 
100
-		$this->event_data[ $slug ] = $args;
100
+		$this->event_data[$slug] = $args;
101 101
 
102 102
 		return true;
103 103
 	}
@@ -105,23 +105,23 @@  discard block
 block discarded – undo
105 105
 	/**
106 106
 	 * @since 1.0.0
107 107
 	 */
108
-	public function deregister( $slug ) {
108
+	public function deregister($slug) {
109 109
 
110
-		if ( ! $this->is_registered( $slug ) ) {
110
+		if ( ! $this->is_registered($slug)) {
111 111
 			return;
112 112
 		}
113 113
 
114
-		parent::deregister( $slug );
114
+		parent::deregister($slug);
115 115
 
116
-		foreach ( (array) $this->event_data[ $slug ]['actions'] as $type => $actions ) {
117
-			foreach ( (array) $actions as $action_slug ) {
118
-				$this->router->remove_event_from_action( $slug, $action_slug, $type );
116
+		foreach ((array) $this->event_data[$slug]['actions'] as $type => $actions) {
117
+			foreach ((array) $actions as $action_slug) {
118
+				$this->router->remove_event_from_action($slug, $action_slug, $type);
119 119
 			}
120 120
 		}
121 121
 
122
-		$this->args->deregister_children( $slug );
122
+		$this->args->deregister_children($slug);
123 123
 
124
-		unset( $this->event_data[ $slug ] );
124
+		unset($this->event_data[$slug]);
125 125
 	}
126 126
 }
127 127
 
Please login to merge, or discard this patch.