Passed
Push — hotfix/fix-counts ( b4ff8e...673622 )
by Paul
04:39
created

SiteReviewsFormShortcode   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 58.33%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 25
ccs 7
cts 12
cp 0.5833
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A hideOptions() 0 8 1
A normalizeAtts() 0 7 2
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Shortcodes;
4
5
use GeminiLabs\SiteReviews\Shortcodes\Shortcode;
6
7
class SiteReviewsFormShortcode extends Shortcode
8
{
9 1
	protected function hideOptions() {
10
		return [
11 1
			'rating' => __( 'Hide the rating field', 'site-reviews' ),
12 1
			'title' => __( 'Hide the title field', 'site-reviews' ),
13 1
			'content' => __( 'Hide the review field', 'site-reviews' ),
14 1
			'name' => __( 'Hide the name field', 'site-reviews' ),
15 1
			'email' => __( 'Hide the email field', 'site-reviews' ),
16 1
			'terms' => __( 'Hide the terms field', 'site-reviews' ),
17
		];
18
	}
19
20
	/**
21
	 * @param array|string $atts
22
	 * @param string $type
23
	 * @return array
24
	 */
25
	public function normalizeAtts( $atts, $type = 'shortcode' )
26
	{
27
		$atts = parent::normalizeAtts( $atts, $type );
28
		if( empty( $atts['id'] )) {
29
			$atts['id'] = substr( md5( serialize( $atts )), 0, 8 );
30
		}
31
		return $atts;
32
	}
33
}
34