Code Duplication    Length = 9-12 lines in 2 locations

src/includes/classes/hook/extension.php 1 location

@@ 72-80 (lines=9) @@
69
			return $settings;
70
		}
71
72
		if ( ! is_array( $settings[ $this->slug ] ) ) {
73
74
			$validator->add_error(
75
				__( 'Invalid settings format.', 'wordpoints' )
76
				, $this->slug
77
			);
78
79
			return $settings;
80
		}
81
82
		$this->validator = $validator;
83
		$this->event_args = $event_args;

src/includes/classes/hook/extension/conditions.php 1 location

@@ 162-173 (lines=12) @@
159
160
		$condition = wordpoints_hooks()->conditions->get( $data_type, $settings['type'] );
161
162
		if ( ! $condition ) {
163
164
			$this->validator->add_error(
165
				sprintf(
166
					__( 'Unknown condition type “%s”.', 'wordpoints' )
167
					, $settings['type']
168
				)
169
				, 'type'
170
			);
171
172
			return false;
173
		}
174
175
		if ( ! isset( $settings['settings'] ) ) {
176
			$this->validator->add_error( __( 'Condition settings are missing.', 'wordpoints' ) );