Test Failed
Push — hotfix/fix-counts ( 9a2e54...d16e24 )
by Paul
03:31
created
plugin/Modules/Date.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -4,49 +4,49 @@
 block discarded – undo
4 4
 
5 5
 class Date
6 6
 {
7
-    /**
8
-     * [60, 1],
9
-     * [60 * 100, 60],
10
-     * [3600 * 70, 3600],
11
-     * [3600 * 24 * 10, 3600 * 24],
12
-     * [3600 * 24 * 30, 3600 * 24 * 7],
13
-     * [3600 * 24 * 30 * 30, 3600 * 24 * 30],
14
-     * [INF, 3600 * 24 * 265],.
15
-     */
16
-    protected static $TIME_PERIODS = [
17
-        [60, 1],
18
-        [6000, 60],
19
-        [252000, 3600],
20
-        [864000, 86400],
21
-        [2592000, 604800],
22
-        [77760000, 2592000],
23
-        [INF, 22896000],
24
-    ];
7
+	/**
8
+	 * [60, 1],
9
+	 * [60 * 100, 60],
10
+	 * [3600 * 70, 3600],
11
+	 * [3600 * 24 * 10, 3600 * 24],
12
+	 * [3600 * 24 * 30, 3600 * 24 * 7],
13
+	 * [3600 * 24 * 30 * 30, 3600 * 24 * 30],
14
+	 * [INF, 3600 * 24 * 265],.
15
+	 */
16
+	protected static $TIME_PERIODS = [
17
+		[60, 1],
18
+		[6000, 60],
19
+		[252000, 3600],
20
+		[864000, 86400],
21
+		[2592000, 604800],
22
+		[77760000, 2592000],
23
+		[INF, 22896000],
24
+	];
25 25
 
26
-    /**
27
-     * @return string
28
-     */
29
-    public function relative($date)
30
-    {
31
-        $diff = time() - strtotime($date);
32
-        foreach (static::$TIME_PERIODS as $i => $timePeriod) {
33
-            if ($diff > $timePeriod[0]) {
34
-                continue;
35
-            }
36
-            $unit = intval(floor($diff / $timePeriod[1]));
37
-            $relativeDates = [
38
-                _n('%s second ago', '%s seconds ago', $unit, 'site-reviews'),
39
-                _n('%s minute ago', '%s minutes ago', $unit, 'site-reviews'),
40
-                _n('an hour ago', '%s hours ago', $unit, 'site-reviews'),
41
-                _n('yesterday', '%s days ago', $unit, 'site-reviews'),
42
-                _n('a week ago', '%s weeks ago', $unit, 'site-reviews'),
43
-                _n('%s month ago', '%s months ago', $unit, 'site-reviews'),
44
-                _n('%s year ago', '%s years ago', $unit, 'site-reviews'),
45
-            ];
46
-            $relativeDate = $relativeDates[$i];
47
-            return false !== strpos($relativeDate, '%s')
48
-                ? sprintf($relativeDate, $unit)
49
-                : $relativeDate;
50
-        }
51
-    }
26
+	/**
27
+	 * @return string
28
+	 */
29
+	public function relative($date)
30
+	{
31
+		$diff = time() - strtotime($date);
32
+		foreach (static::$TIME_PERIODS as $i => $timePeriod) {
33
+			if ($diff > $timePeriod[0]) {
34
+				continue;
35
+			}
36
+			$unit = intval(floor($diff / $timePeriod[1]));
37
+			$relativeDates = [
38
+				_n('%s second ago', '%s seconds ago', $unit, 'site-reviews'),
39
+				_n('%s minute ago', '%s minutes ago', $unit, 'site-reviews'),
40
+				_n('an hour ago', '%s hours ago', $unit, 'site-reviews'),
41
+				_n('yesterday', '%s days ago', $unit, 'site-reviews'),
42
+				_n('a week ago', '%s weeks ago', $unit, 'site-reviews'),
43
+				_n('%s month ago', '%s months ago', $unit, 'site-reviews'),
44
+				_n('%s year ago', '%s years ago', $unit, 'site-reviews'),
45
+			];
46
+			$relativeDate = $relativeDates[$i];
47
+			return false !== strpos($relativeDate, '%s')
48
+				? sprintf($relativeDate, $unit)
49
+				: $relativeDate;
50
+		}
51
+	}
52 52
 }
Please login to merge, or discard this patch.
plugin/Modules/Translator.php 1 patch
Indentation   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -6,151 +6,151 @@
 block discarded – undo
6 6
 
7 7
 class Translator
8 8
 {
9
-    /**
10
-     * @param string $translation
11
-     * @param string $text
12
-     * @param string $domain
13
-     * @return string
14
-     */
15
-    public function filterGettext($translation, $text, $domain)
16
-    {
17
-        return $this->translate($translation, $domain, [
18
-            'single' => $text,
19
-        ]);
20
-    }
9
+	/**
10
+	 * @param string $translation
11
+	 * @param string $text
12
+	 * @param string $domain
13
+	 * @return string
14
+	 */
15
+	public function filterGettext($translation, $text, $domain)
16
+	{
17
+		return $this->translate($translation, $domain, [
18
+			'single' => $text,
19
+		]);
20
+	}
21 21
 
22
-    /**
23
-     * @param string $translation
24
-     * @param string $text
25
-     * @param string $context
26
-     * @param string $domain
27
-     * @return string
28
-     */
29
-    public function filterGettextWithContext($translation, $text, $context, $domain)
30
-    {
31
-        return $this->translate($translation, $domain, [
32
-            'context' => $context,
33
-            'single' => $text,
34
-        ]);
35
-    }
22
+	/**
23
+	 * @param string $translation
24
+	 * @param string $text
25
+	 * @param string $context
26
+	 * @param string $domain
27
+	 * @return string
28
+	 */
29
+	public function filterGettextWithContext($translation, $text, $context, $domain)
30
+	{
31
+		return $this->translate($translation, $domain, [
32
+			'context' => $context,
33
+			'single' => $text,
34
+		]);
35
+	}
36 36
 
37
-    /**
38
-     * @param string $translation
39
-     * @param string $single
40
-     * @param string $plural
41
-     * @param int $number
42
-     * @param string $domain
43
-     * @return string
44
-     */
45
-    public function filterNgettext($translation, $single, $plural, $number, $domain)
46
-    {
47
-        return $this->translate($translation, $domain, [
48
-            'number' => $number,
49
-            'plural' => $plural,
50
-            'single' => $single,
51
-        ]);
52
-    }
37
+	/**
38
+	 * @param string $translation
39
+	 * @param string $single
40
+	 * @param string $plural
41
+	 * @param int $number
42
+	 * @param string $domain
43
+	 * @return string
44
+	 */
45
+	public function filterNgettext($translation, $single, $plural, $number, $domain)
46
+	{
47
+		return $this->translate($translation, $domain, [
48
+			'number' => $number,
49
+			'plural' => $plural,
50
+			'single' => $single,
51
+		]);
52
+	}
53 53
 
54
-    /**
55
-     * @param string $translation
56
-     * @param string $single
57
-     * @param string $plural
58
-     * @param int $number
59
-     * @param string $context
60
-     * @param string $domain
61
-     * @return string
62
-     */
63
-    public function filterNgettextWithContext($translation, $single, $plural, $number, $context, $domain)
64
-    {
65
-        return $this->translate($translation, $domain, [
66
-            'context' => $context,
67
-            'number' => $number,
68
-            'plural' => $plural,
69
-            'single' => $single,
70
-        ]);
71
-    }
54
+	/**
55
+	 * @param string $translation
56
+	 * @param string $single
57
+	 * @param string $plural
58
+	 * @param int $number
59
+	 * @param string $context
60
+	 * @param string $domain
61
+	 * @return string
62
+	 */
63
+	public function filterNgettextWithContext($translation, $single, $plural, $number, $context, $domain)
64
+	{
65
+		return $this->translate($translation, $domain, [
66
+			'context' => $context,
67
+			'number' => $number,
68
+			'plural' => $plural,
69
+			'single' => $single,
70
+		]);
71
+	}
72 72
 
73
-    /**
74
-     * @param string $original
75
-     * @param string $domain
76
-     * @return string
77
-     */
78
-    public function translate($original, $domain, array $args)
79
-    {
80
-        $domains = apply_filters('site-reviews/translator/domains', [Application::ID]);
81
-        if (!in_array($domain, $domains)) {
82
-            return $original;
83
-        }
84
-        $args = $this->normalizeTranslationArgs($args);
85
-        $strings = $this->getTranslationStrings($args['single'], $args['plural']);
86
-        if (empty($strings)) {
87
-            return $original;
88
-        }
89
-        $string = current($strings);
90
-        return 'plural' == $string['type']
91
-            ? $this->translatePlural($domain, $string, $args)
92
-            : $this->translateSingle($domain, $string, $args);
93
-    }
73
+	/**
74
+	 * @param string $original
75
+	 * @param string $domain
76
+	 * @return string
77
+	 */
78
+	public function translate($original, $domain, array $args)
79
+	{
80
+		$domains = apply_filters('site-reviews/translator/domains', [Application::ID]);
81
+		if (!in_array($domain, $domains)) {
82
+			return $original;
83
+		}
84
+		$args = $this->normalizeTranslationArgs($args);
85
+		$strings = $this->getTranslationStrings($args['single'], $args['plural']);
86
+		if (empty($strings)) {
87
+			return $original;
88
+		}
89
+		$string = current($strings);
90
+		return 'plural' == $string['type']
91
+			? $this->translatePlural($domain, $string, $args)
92
+			: $this->translateSingle($domain, $string, $args);
93
+	}
94 94
 
95
-    /**
96
-     * @param string $single
97
-     * @param string $plural
98
-     * @return array
99
-     */
100
-    protected function getTranslationStrings($single, $plural)
101
-    {
102
-        return array_filter(glsr(Translation::class)->translations(), function ($string) use ($single, $plural) {
103
-            return $string['s1'] == html_entity_decode($single, ENT_COMPAT, 'UTF-8')
104
-                && $string['p1'] == html_entity_decode($plural, ENT_COMPAT, 'UTF-8');
105
-        });
106
-    }
95
+	/**
96
+	 * @param string $single
97
+	 * @param string $plural
98
+	 * @return array
99
+	 */
100
+	protected function getTranslationStrings($single, $plural)
101
+	{
102
+		return array_filter(glsr(Translation::class)->translations(), function ($string) use ($single, $plural) {
103
+			return $string['s1'] == html_entity_decode($single, ENT_COMPAT, 'UTF-8')
104
+				&& $string['p1'] == html_entity_decode($plural, ENT_COMPAT, 'UTF-8');
105
+		});
106
+	}
107 107
 
108
-    /**
109
-     * @return array
110
-     */
111
-    protected function normalizeTranslationArgs(array $args)
112
-    {
113
-        $defaults = [
114
-            'context' => '',
115
-            'number' => 1,
116
-            'plural' => '',
117
-            'single' => '',
118
-        ];
119
-        return shortcode_atts($defaults, $args);
120
-    }
108
+	/**
109
+	 * @return array
110
+	 */
111
+	protected function normalizeTranslationArgs(array $args)
112
+	{
113
+		$defaults = [
114
+			'context' => '',
115
+			'number' => 1,
116
+			'plural' => '',
117
+			'single' => '',
118
+		];
119
+		return shortcode_atts($defaults, $args);
120
+	}
121 121
 
122
-    /**
123
-     * @param string $domain
124
-     * @return string
125
-     */
126
-    protected function translatePlural($domain, array $string, array $args)
127
-    {
128
-        if (!empty($string['s2'])) {
129
-            $args['single'] = $string['s2'];
130
-        }
131
-        if (!empty($string['p2'])) {
132
-            $args['plural'] = $string['p2'];
133
-        }
134
-        return get_translations_for_domain($domain)->translate_plural(
135
-            $args['single'],
136
-            $args['plural'],
137
-            $args['number'],
138
-            $args['context']
139
-        );
140
-    }
122
+	/**
123
+	 * @param string $domain
124
+	 * @return string
125
+	 */
126
+	protected function translatePlural($domain, array $string, array $args)
127
+	{
128
+		if (!empty($string['s2'])) {
129
+			$args['single'] = $string['s2'];
130
+		}
131
+		if (!empty($string['p2'])) {
132
+			$args['plural'] = $string['p2'];
133
+		}
134
+		return get_translations_for_domain($domain)->translate_plural(
135
+			$args['single'],
136
+			$args['plural'],
137
+			$args['number'],
138
+			$args['context']
139
+		);
140
+	}
141 141
 
142
-    /**
143
-     * @param string $domain
144
-     * @return string
145
-     */
146
-    protected function translateSingle($domain, array $string, array $args)
147
-    {
148
-        if (!empty($string['s2'])) {
149
-            $args['single'] = $string['s2'];
150
-        }
151
-        return get_translations_for_domain($domain)->translate(
152
-            $args['single'],
153
-            $args['context']
154
-        );
155
-    }
142
+	/**
143
+	 * @param string $domain
144
+	 * @return string
145
+	 */
146
+	protected function translateSingle($domain, array $string, array $args)
147
+	{
148
+		if (!empty($string['s2'])) {
149
+			$args['single'] = $string['s2'];
150
+		}
151
+		return get_translations_for_domain($domain)->translate(
152
+			$args['single'],
153
+			$args['context']
154
+		);
155
+	}
156 156
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Attributes.php 1 patch
Indentation   +253 added lines, -253 removed lines patch added patch discarded remove patch
@@ -6,285 +6,285 @@
 block discarded – undo
6 6
 
7 7
 class Attributes
8 8
 {
9
-    const ATTRIBUTES_A = [
10
-        'download', 'href', 'hreflang', 'ping', 'referrerpolicy', 'rel', 'target', 'type',
11
-    ];
9
+	const ATTRIBUTES_A = [
10
+		'download', 'href', 'hreflang', 'ping', 'referrerpolicy', 'rel', 'target', 'type',
11
+	];
12 12
 
13
-    const ATTRIBUTES_BUTTON = [
14
-        'autofocus', 'disabled', 'form', 'formaction', 'formenctype', 'formmethod',
15
-        'formnovalidate', 'formtarget', 'name', 'type', 'value',
16
-    ];
13
+	const ATTRIBUTES_BUTTON = [
14
+		'autofocus', 'disabled', 'form', 'formaction', 'formenctype', 'formmethod',
15
+		'formnovalidate', 'formtarget', 'name', 'type', 'value',
16
+	];
17 17
 
18
-    const ATTRIBUTES_FORM = [
19
-        'accept', 'accept-charset', 'action', 'autocapitalize', 'autocomplete', 'enctype', 'method',
20
-        'name', 'novalidate', 'target',
21
-    ];
18
+	const ATTRIBUTES_FORM = [
19
+		'accept', 'accept-charset', 'action', 'autocapitalize', 'autocomplete', 'enctype', 'method',
20
+		'name', 'novalidate', 'target',
21
+	];
22 22
 
23
-    const ATTRIBUTES_IMG = [
24
-        'alt', 'crossorigin', 'decoding', 'height', 'ismap', 'referrerpolicy', 'sizes', 'src',
25
-        'srcset', 'width', 'usemap',
26
-    ];
23
+	const ATTRIBUTES_IMG = [
24
+		'alt', 'crossorigin', 'decoding', 'height', 'ismap', 'referrerpolicy', 'sizes', 'src',
25
+		'srcset', 'width', 'usemap',
26
+	];
27 27
 
28
-    const ATTRIBUTES_INPUT = [
29
-        'accept', 'autocomplete', 'autocorrect', 'autofocus', 'capture', 'checked', 'disabled',
30
-        'form', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget', 'height',
31
-        'incremental', 'inputmode', 'list', 'max', 'maxlength', 'min', 'minlength', 'multiple',
32
-        'name', 'pattern', 'placeholder', 'readonly', 'results', 'required', 'selectionDirection',
33
-        'selectionEnd', 'selectionStart', 'size', 'spellcheck', 'src', 'step', 'tabindex', 'type',
34
-        'value', 'webkitdirectory', 'width',
35
-    ];
28
+	const ATTRIBUTES_INPUT = [
29
+		'accept', 'autocomplete', 'autocorrect', 'autofocus', 'capture', 'checked', 'disabled',
30
+		'form', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget', 'height',
31
+		'incremental', 'inputmode', 'list', 'max', 'maxlength', 'min', 'minlength', 'multiple',
32
+		'name', 'pattern', 'placeholder', 'readonly', 'results', 'required', 'selectionDirection',
33
+		'selectionEnd', 'selectionStart', 'size', 'spellcheck', 'src', 'step', 'tabindex', 'type',
34
+		'value', 'webkitdirectory', 'width',
35
+	];
36 36
 
37
-    const ATTRIBUTES_LABEL = [
38
-        'for',
39
-    ];
37
+	const ATTRIBUTES_LABEL = [
38
+		'for',
39
+	];
40 40
 
41
-    const ATTRIBUTES_OPTION = [
42
-        'disabled', 'label', 'selected', 'value',
43
-    ];
41
+	const ATTRIBUTES_OPTION = [
42
+		'disabled', 'label', 'selected', 'value',
43
+	];
44 44
 
45
-    const ATTRIBUTES_SELECT = [
46
-        'autofocus', 'disabled', 'form', 'multiple', 'name', 'required', 'size',
47
-    ];
45
+	const ATTRIBUTES_SELECT = [
46
+		'autofocus', 'disabled', 'form', 'multiple', 'name', 'required', 'size',
47
+	];
48 48
 
49
-    const ATTRIBUTES_TEXTAREA = [
50
-        'autocapitalize', 'autocomplete', 'autofocus', 'cols', 'disabled', 'form', 'maxlength',
51
-        'minlength', 'name', 'placeholder', 'readonly', 'required', 'rows', 'spellcheck', 'wrap',
52
-    ];
49
+	const ATTRIBUTES_TEXTAREA = [
50
+		'autocapitalize', 'autocomplete', 'autofocus', 'cols', 'disabled', 'form', 'maxlength',
51
+		'minlength', 'name', 'placeholder', 'readonly', 'required', 'rows', 'spellcheck', 'wrap',
52
+	];
53 53
 
54
-    const BOOLEAN_ATTRIBUTES = [
55
-        'autofocus', 'capture', 'checked', 'disabled', 'draggable', 'formnovalidate', 'hidden',
56
-        'multiple', 'novalidate', 'readonly', 'required', 'selected', 'spellcheck',
57
-        'webkitdirectory',
58
-    ];
54
+	const BOOLEAN_ATTRIBUTES = [
55
+		'autofocus', 'capture', 'checked', 'disabled', 'draggable', 'formnovalidate', 'hidden',
56
+		'multiple', 'novalidate', 'readonly', 'required', 'selected', 'spellcheck',
57
+		'webkitdirectory',
58
+	];
59 59
 
60
-    const GLOBAL_ATTRIBUTES = [
61
-        'accesskey', 'class', 'contenteditable', 'contextmenu', 'dir', 'draggable', 'dropzone',
62
-        'hidden', 'id', 'lang', 'spellcheck', 'style', 'tabindex', 'title',
63
-    ];
60
+	const GLOBAL_ATTRIBUTES = [
61
+		'accesskey', 'class', 'contenteditable', 'contextmenu', 'dir', 'draggable', 'dropzone',
62
+		'hidden', 'id', 'lang', 'spellcheck', 'style', 'tabindex', 'title',
63
+	];
64 64
 
65
-    const GLOBAL_WILDCARD_ATTRIBUTES = [
66
-        'aria-', 'data-', 'item', 'on',
67
-    ];
65
+	const GLOBAL_WILDCARD_ATTRIBUTES = [
66
+		'aria-', 'data-', 'item', 'on',
67
+	];
68 68
 
69
-    const INPUT_TYPES = [
70
-        'button', 'checkbox', 'color', 'date', 'datetime-local', 'email', 'file', 'hidden', 'image',
71
-        'month', 'number', 'password', 'radio', 'range', 'reset', 'search', 'submit', 'tel', 'text',
72
-        'time', 'url', 'week',
73
-    ];
69
+	const INPUT_TYPES = [
70
+		'button', 'checkbox', 'color', 'date', 'datetime-local', 'email', 'file', 'hidden', 'image',
71
+		'month', 'number', 'password', 'radio', 'range', 'reset', 'search', 'submit', 'tel', 'text',
72
+		'time', 'url', 'week',
73
+	];
74 74
 
75
-    /**
76
-     * @var array
77
-     */
78
-    protected $attributes = [];
75
+	/**
76
+	 * @var array
77
+	 */
78
+	protected $attributes = [];
79 79
 
80
-    /**
81
-     * @param string $method
82
-     * @param array $args
83
-     * @return static
84
-     */
85
-    public function __call($method, $args)
86
-    {
87
-        $args += [[], false];
88
-        $constant = 'static::ATTRIBUTES_'.strtoupper($method);
89
-        $allowedAttributeKeys = defined($constant)
90
-            ? constant($constant)
91
-            : [];
92
-        $this->normalize((array) $args[0], $allowedAttributeKeys);
93
-        $this->normalizeInputType($method);
94
-        return $this;
95
-    }
80
+	/**
81
+	 * @param string $method
82
+	 * @param array $args
83
+	 * @return static
84
+	 */
85
+	public function __call($method, $args)
86
+	{
87
+		$args += [[], false];
88
+		$constant = 'static::ATTRIBUTES_'.strtoupper($method);
89
+		$allowedAttributeKeys = defined($constant)
90
+			? constant($constant)
91
+			: [];
92
+		$this->normalize((array) $args[0], $allowedAttributeKeys);
93
+		$this->normalizeInputType($method);
94
+		return $this;
95
+	}
96 96
 
97
-    /**
98
-     * @return array
99
-     */
100
-    public function toArray()
101
-    {
102
-        return $this->attributes;
103
-    }
97
+	/**
98
+	 * @return array
99
+	 */
100
+	public function toArray()
101
+	{
102
+		return $this->attributes;
103
+	}
104 104
 
105
-    /**
106
-     * @return string
107
-     */
108
-    public function toString()
109
-    {
110
-        $attributes = [];
111
-        foreach ($this->attributes as $attribute => $value) {
112
-            $quote = $this->getQuoteChar($attribute);
113
-            $attributes[] = in_array($attribute, static::BOOLEAN_ATTRIBUTES)
114
-                ? $attribute
115
-                : $attribute.'='.$quote.implode(',', (array) $value).$quote;
116
-        }
117
-        return implode(' ', $attributes);
118
-    }
105
+	/**
106
+	 * @return string
107
+	 */
108
+	public function toString()
109
+	{
110
+		$attributes = [];
111
+		foreach ($this->attributes as $attribute => $value) {
112
+			$quote = $this->getQuoteChar($attribute);
113
+			$attributes[] = in_array($attribute, static::BOOLEAN_ATTRIBUTES)
114
+				? $attribute
115
+				: $attribute.'='.$quote.implode(',', (array) $value).$quote;
116
+		}
117
+		return implode(' ', $attributes);
118
+	}
119 119
 
120
-    /**
121
-     * @return array
122
-     */
123
-    protected function filterAttributes(array $allowedAttributeKeys)
124
-    {
125
-        return array_intersect_key($this->attributes, array_flip($allowedAttributeKeys));
126
-    }
120
+	/**
121
+	 * @return array
122
+	 */
123
+	protected function filterAttributes(array $allowedAttributeKeys)
124
+	{
125
+		return array_intersect_key($this->attributes, array_flip($allowedAttributeKeys));
126
+	}
127 127
 
128
-    /**
129
-     * @return array
130
-     */
131
-    protected function filterGlobalAttributes()
132
-    {
133
-        $globalAttributes = $this->filterAttributes(static::GLOBAL_ATTRIBUTES);
134
-        $wildcards = [];
135
-        foreach (static::GLOBAL_WILDCARD_ATTRIBUTES as $wildcard) {
136
-            $newWildcards = array_filter($this->attributes, function ($key) use ($wildcard) {
137
-                return glsr(Helper::class)->startsWith($wildcard, $key);
138
-            }, ARRAY_FILTER_USE_KEY);
139
-            $wildcards = array_merge($wildcards, $newWildcards);
140
-        }
141
-        return array_merge($globalAttributes, $wildcards);
142
-    }
128
+	/**
129
+	 * @return array
130
+	 */
131
+	protected function filterGlobalAttributes()
132
+	{
133
+		$globalAttributes = $this->filterAttributes(static::GLOBAL_ATTRIBUTES);
134
+		$wildcards = [];
135
+		foreach (static::GLOBAL_WILDCARD_ATTRIBUTES as $wildcard) {
136
+			$newWildcards = array_filter($this->attributes, function ($key) use ($wildcard) {
137
+				return glsr(Helper::class)->startsWith($wildcard, $key);
138
+			}, ARRAY_FILTER_USE_KEY);
139
+			$wildcards = array_merge($wildcards, $newWildcards);
140
+		}
141
+		return array_merge($globalAttributes, $wildcards);
142
+	}
143 143
 
144
-    /**
145
-     * @return array
146
-     */
147
-    protected function getPermanentAttributes()
148
-    {
149
-        $permanentAttributes = [];
150
-        if (array_key_exists('value', $this->attributes)) {
151
-            $permanentAttributes['value'] = $this->attributes['value'];
152
-        }
153
-        return $permanentAttributes;
154
-    }
144
+	/**
145
+	 * @return array
146
+	 */
147
+	protected function getPermanentAttributes()
148
+	{
149
+		$permanentAttributes = [];
150
+		if (array_key_exists('value', $this->attributes)) {
151
+			$permanentAttributes['value'] = $this->attributes['value'];
152
+		}
153
+		return $permanentAttributes;
154
+	}
155 155
 
156
-    /**
157
-     * @param string $attribute
158
-     * @return string
159
-     */
160
-    protected function getQuoteChar($attribute)
161
-    {
162
-        return glsr(Helper::class)->startsWith('data-', $attribute)
163
-            ? '\''
164
-            : '"';
165
-    }
156
+	/**
157
+	 * @param string $attribute
158
+	 * @return string
159
+	 */
160
+	protected function getQuoteChar($attribute)
161
+	{
162
+		return glsr(Helper::class)->startsWith('data-', $attribute)
163
+			? '\''
164
+			: '"';
165
+	}
166 166
 
167
-    /**
168
-     * @param string $key
169
-     * @param mixed $value
170
-     * @return bool
171
-     */
172
-    protected function isAttributeKeyNumeric($key, $value)
173
-    {
174
-        return is_string($value)
175
-            && is_numeric($key)
176
-            && !array_key_exists($value, $this->attributes);
177
-    }
167
+	/**
168
+	 * @param string $key
169
+	 * @param mixed $value
170
+	 * @return bool
171
+	 */
172
+	protected function isAttributeKeyNumeric($key, $value)
173
+	{
174
+		return is_string($value)
175
+			&& is_numeric($key)
176
+			&& !array_key_exists($value, $this->attributes);
177
+	}
178 178
 
179
-    /**
180
-     * @return void
181
-     */
182
-    protected function normalize(array $args, array $allowedAttributeKeys)
183
-    {
184
-        $this->attributes = array_change_key_case($args, CASE_LOWER);
185
-        $this->normalizeBooleanAttributes();
186
-        $this->normalizeDataAttributes();
187
-        $this->normalizeStringAttributes();
188
-        $this->removeEmptyAttributes();
189
-        $this->removeIndexedAttributes();
190
-        $this->attributes = array_merge(
191
-            $this->filterGlobalAttributes(),
192
-            $this->filterAttributes($allowedAttributeKeys)
193
-        );
194
-    }
179
+	/**
180
+	 * @return void
181
+	 */
182
+	protected function normalize(array $args, array $allowedAttributeKeys)
183
+	{
184
+		$this->attributes = array_change_key_case($args, CASE_LOWER);
185
+		$this->normalizeBooleanAttributes();
186
+		$this->normalizeDataAttributes();
187
+		$this->normalizeStringAttributes();
188
+		$this->removeEmptyAttributes();
189
+		$this->removeIndexedAttributes();
190
+		$this->attributes = array_merge(
191
+			$this->filterGlobalAttributes(),
192
+			$this->filterAttributes($allowedAttributeKeys)
193
+		);
194
+	}
195 195
 
196
-    /**
197
-     * @return void
198
-     */
199
-    protected function normalizeBooleanAttributes()
200
-    {
201
-        foreach ($this->attributes as $key => $value) {
202
-            if ($this->isAttributeKeyNumeric($key, $value)) {
203
-                $key = $value;
204
-                $value = true;
205
-            }
206
-            if (!in_array($key, static::BOOLEAN_ATTRIBUTES)) {
207
-                continue;
208
-            }
209
-            $this->attributes[$key] = wp_validate_boolean($value);
210
-        }
211
-    }
196
+	/**
197
+	 * @return void
198
+	 */
199
+	protected function normalizeBooleanAttributes()
200
+	{
201
+		foreach ($this->attributes as $key => $value) {
202
+			if ($this->isAttributeKeyNumeric($key, $value)) {
203
+				$key = $value;
204
+				$value = true;
205
+			}
206
+			if (!in_array($key, static::BOOLEAN_ATTRIBUTES)) {
207
+				continue;
208
+			}
209
+			$this->attributes[$key] = wp_validate_boolean($value);
210
+		}
211
+	}
212 212
 
213
-    /**
214
-     * @return void
215
-     */
216
-    protected function normalizeDataAttributes()
217
-    {
218
-        foreach ($this->attributes as $key => $value) {
219
-            if ($this->isAttributeKeyNumeric($key, $value)) {
220
-                $key = $value;
221
-                $value = '';
222
-            }
223
-            if (!glsr(Helper::class)->startsWith('data-', $key)) {
224
-                continue;
225
-            }
226
-            if (is_array($value)) {
227
-                $value = json_encode($value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
228
-            }
229
-            $this->attributes[$key] = $value;
230
-        }
231
-    }
213
+	/**
214
+	 * @return void
215
+	 */
216
+	protected function normalizeDataAttributes()
217
+	{
218
+		foreach ($this->attributes as $key => $value) {
219
+			if ($this->isAttributeKeyNumeric($key, $value)) {
220
+				$key = $value;
221
+				$value = '';
222
+			}
223
+			if (!glsr(Helper::class)->startsWith('data-', $key)) {
224
+				continue;
225
+			}
226
+			if (is_array($value)) {
227
+				$value = json_encode($value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
228
+			}
229
+			$this->attributes[$key] = $value;
230
+		}
231
+	}
232 232
 
233
-    /**
234
-     * @return void
235
-     */
236
-    protected function normalizeStringAttributes()
237
-    {
238
-        foreach ($this->attributes as $key => $value) {
239
-            if (!is_string($value)) {
240
-                continue;
241
-            }
242
-            $this->attributes[$key] = trim($value);
243
-        }
244
-    }
233
+	/**
234
+	 * @return void
235
+	 */
236
+	protected function normalizeStringAttributes()
237
+	{
238
+		foreach ($this->attributes as $key => $value) {
239
+			if (!is_string($value)) {
240
+				continue;
241
+			}
242
+			$this->attributes[$key] = trim($value);
243
+		}
244
+	}
245 245
 
246
-    /**
247
-     * @param string $method
248
-     * @return void
249
-     */
250
-    protected function normalizeInputType($method)
251
-    {
252
-        if ('input' != $method) {
253
-            return;
254
-        }
255
-        $attributes = wp_parse_args($this->attributes, ['type' => '']);
256
-        if (!in_array($attributes['type'], static::INPUT_TYPES)) {
257
-            $this->attributes['type'] = 'text';
258
-        }
259
-    }
246
+	/**
247
+	 * @param string $method
248
+	 * @return void
249
+	 */
250
+	protected function normalizeInputType($method)
251
+	{
252
+		if ('input' != $method) {
253
+			return;
254
+		}
255
+		$attributes = wp_parse_args($this->attributes, ['type' => '']);
256
+		if (!in_array($attributes['type'], static::INPUT_TYPES)) {
257
+			$this->attributes['type'] = 'text';
258
+		}
259
+	}
260 260
 
261
-    /**
262
-     * @return void
263
-     */
264
-    protected function removeEmptyAttributes()
265
-    {
266
-        $attributes = $this->attributes;
267
-        $permanentAttributes = $this->getPermanentAttributes();
268
-        foreach ($this->attributes as $key => $value) {
269
-            if (in_array($key, static::BOOLEAN_ATTRIBUTES) && !$value) {
270
-                unset($attributes[$key]);
271
-            }
272
-            if (glsr(Helper::class)->startsWith('data-', $key)) {
273
-                $permanentAttributes[$key] = $value;
274
-                unset($attributes[$key]);
275
-            }
276
-        }
277
-        $this->attributes = array_merge(array_filter($attributes), $permanentAttributes);
278
-    }
261
+	/**
262
+	 * @return void
263
+	 */
264
+	protected function removeEmptyAttributes()
265
+	{
266
+		$attributes = $this->attributes;
267
+		$permanentAttributes = $this->getPermanentAttributes();
268
+		foreach ($this->attributes as $key => $value) {
269
+			if (in_array($key, static::BOOLEAN_ATTRIBUTES) && !$value) {
270
+				unset($attributes[$key]);
271
+			}
272
+			if (glsr(Helper::class)->startsWith('data-', $key)) {
273
+				$permanentAttributes[$key] = $value;
274
+				unset($attributes[$key]);
275
+			}
276
+		}
277
+		$this->attributes = array_merge(array_filter($attributes), $permanentAttributes);
278
+	}
279 279
 
280
-    /**
281
-     * @return void
282
-     */
283
-    protected function removeIndexedAttributes()
284
-    {
285
-        $this->attributes = array_diff_key(
286
-            $this->attributes,
287
-            array_filter($this->attributes, 'is_numeric', ARRAY_FILTER_USE_KEY)
288
-        );
289
-    }
280
+	/**
281
+	 * @return void
282
+	 */
283
+	protected function removeIndexedAttributes()
284
+	{
285
+		$this->attributes = array_diff_key(
286
+			$this->attributes,
287
+			array_filter($this->attributes, 'is_numeric', ARRAY_FILTER_USE_KEY)
288
+		);
289
+	}
290 290
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Fields/Hidden.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@
 block discarded – undo
4 4
 
5 5
 class Hidden extends Field
6 6
 {
7
-    /**
8
-     * @return array
9
-     */
10
-    public static function required()
11
-    {
12
-        return [
13
-            'is_raw' => true,
14
-        ];
15
-    }
7
+	/**
8
+	 * @return array
9
+	 */
10
+	public static function required()
11
+	{
12
+		return [
13
+			'is_raw' => true,
14
+		];
15
+	}
16 16
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Fields/Code.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -4,33 +4,33 @@
 block discarded – undo
4 4
 
5 5
 class Code extends Field
6 6
 {
7
-    /**
8
-     * @return string|void
9
-     */
10
-    public function build()
11
-    {
12
-        $this->builder->tag = 'textarea';
13
-        $this->mergeFieldArgs();
14
-        return $this->builder->getTag();
15
-    }
7
+	/**
8
+	 * @return string|void
9
+	 */
10
+	public function build()
11
+	{
12
+		$this->builder->tag = 'textarea';
13
+		$this->mergeFieldArgs();
14
+		return $this->builder->getTag();
15
+	}
16 16
 
17
-    /**
18
-     * @return array
19
-     */
20
-    public static function defaults()
21
-    {
22
-        return [
23
-            'class' => 'large-text code',
24
-        ];
25
-    }
17
+	/**
18
+	 * @return array
19
+	 */
20
+	public static function defaults()
21
+	{
22
+		return [
23
+			'class' => 'large-text code',
24
+		];
25
+	}
26 26
 
27
-    /**
28
-     * @return array
29
-     */
30
-    public static function required()
31
-    {
32
-        return [
33
-            'type' => 'textarea',
34
-        ];
35
-    }
27
+	/**
28
+	 * @return array
29
+	 */
30
+	public static function required()
31
+	{
32
+		return [
33
+			'type' => 'textarea',
34
+		];
35
+	}
36 36
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Fields/Button.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@
 block discarded – undo
4 4
 
5 5
 class Button extends Field
6 6
 {
7
-    /**
8
-     * @return array
9
-     */
10
-    public static function defaults()
11
-    {
12
-        return [
13
-            'class' => 'button glsr-button',
14
-        ];
15
-    }
7
+	/**
8
+	 * @return array
9
+	 */
10
+	public static function defaults()
11
+	{
12
+		return [
13
+			'class' => 'button glsr-button',
14
+		];
15
+	}
16 16
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Fields/Text.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@
 block discarded – undo
4 4
 
5 5
 class Text extends Field
6 6
 {
7
-    /**
8
-     * @return array
9
-     */
10
-    public static function defaults()
11
-    {
12
-        return [
13
-            'class' => 'regular-text',
14
-        ];
15
-    }
7
+	/**
8
+	 * @return array
9
+	 */
10
+	public static function defaults()
11
+	{
12
+		return [
13
+			'class' => 'regular-text',
14
+		];
15
+	}
16 16
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Fields/Honeypot.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -4,30 +4,30 @@
 block discarded – undo
4 4
 
5 5
 class Honeypot extends Field
6 6
 {
7
-    /**
8
-     * @return string|void
9
-     */
10
-    public function build()
11
-    {
12
-        $this->builder->args = wp_parse_args($this->builder->args, [
13
-            'name' => $this->builder->args['text'],
14
-        ]);
15
-        $this->builder->tag = 'input';
16
-        $this->mergeFieldArgs();
17
-        return $this->builder->getOpeningTag();
18
-    }
7
+	/**
8
+	 * @return string|void
9
+	 */
10
+	public function build()
11
+	{
12
+		$this->builder->args = wp_parse_args($this->builder->args, [
13
+			'name' => $this->builder->args['text'],
14
+		]);
15
+		$this->builder->tag = 'input';
16
+		$this->mergeFieldArgs();
17
+		return $this->builder->getOpeningTag();
18
+	}
19 19
 
20
-    /**
21
-     * @return array
22
-     */
23
-    public static function required()
24
-    {
25
-        return [
26
-            'autocomplete' => 'off',
27
-            'is_raw' => true,
28
-            'style' => 'display:none!important',
29
-            'tabindex' => '-1',
30
-            'type' => 'text',
31
-        ];
32
-    }
20
+	/**
21
+	 * @return array
22
+	 */
23
+	public static function required()
24
+	{
25
+		return [
26
+			'autocomplete' => 'off',
27
+			'is_raw' => true,
28
+			'style' => 'display:none!important',
29
+			'tabindex' => '-1',
30
+			'type' => 'text',
31
+		];
32
+	}
33 33
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Fields/YesNo.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -4,38 +4,38 @@
 block discarded – undo
4 4
 
5 5
 class YesNo extends Field
6 6
 {
7
-    /**
8
-     * @return string|void
9
-     */
10
-    public function build()
11
-    {
12
-        $this->builder->tag = 'input';
13
-        $this->mergeFieldArgs();
14
-        return $this->builder->getTag();
15
-    }
7
+	/**
8
+	 * @return string|void
9
+	 */
10
+	public function build()
11
+	{
12
+		$this->builder->tag = 'input';
13
+		$this->mergeFieldArgs();
14
+		return $this->builder->getTag();
15
+	}
16 16
 
17
-    /**
18
-     * @return array
19
-     */
20
-    public static function defaults()
21
-    {
22
-        return [
23
-            'class' => 'inline',
24
-        ];
25
-    }
17
+	/**
18
+	 * @return array
19
+	 */
20
+	public static function defaults()
21
+	{
22
+		return [
23
+			'class' => 'inline',
24
+		];
25
+	}
26 26
 
27
-    /**
28
-     * @return array
29
-     */
30
-    public static function required()
31
-    {
32
-        return [
33
-            'is_multi' => true,
34
-            'options' => [
35
-                'no' => __('No', 'site-reviews'),
36
-                'yes' => __('Yes', 'site-reviews'),
37
-            ],
38
-            'type' => 'radio',
39
-        ];
40
-    }
27
+	/**
28
+	 * @return array
29
+	 */
30
+	public static function required()
31
+	{
32
+		return [
33
+			'is_multi' => true,
34
+			'options' => [
35
+				'no' => __('No', 'site-reviews'),
36
+				'yes' => __('Yes', 'site-reviews'),
37
+			],
38
+			'type' => 'radio',
39
+		];
40
+	}
41 41
 }
Please login to merge, or discard this patch.