Passed
Push — master ( 9b46a7...ed8579 )
by Paul
03:56
created
plugin/Widgets/SiteReviewsFormWidget.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,30 +20,30 @@  discard block
 block discarded – undo
20 20
 			'class' => 'widefat',
21 21
 			'label' => __( 'Title', 'site-reviews' ),
22 22
 			'name' => 'title',
23
-		]);
23
+		] );
24 24
 		$this->renderField( 'textarea', [
25 25
 			'class' => 'widefat',
26 26
 			'label' => __( 'Description', 'site-reviews' ),
27 27
 			'name' => 'description',
28
-		]);
28
+		] );
29 29
 		$this->renderField( 'select', [
30 30
 			'class' => 'widefat',
31 31
 			'label' => __( 'Automatically assign a category', 'site-reviews' ),
32 32
 			'name' => 'category',
33 33
 			'options' => ['' => __( 'Do not assign a category', 'site-reviews' )] + $terms,
34
-		]);
34
+		] );
35 35
 		$this->renderField( 'text', [
36 36
 			'class' => 'widefat',
37 37
 			'default' => '',
38 38
 			'description' => sprintf( __( 'You may also enter %s to assign to the current post.', 'site-reviews' ), '<code>post_id</code>' ),
39 39
 			'label' => __( 'Assign reviews to a custom page/post ID', 'site-reviews' ),
40 40
 			'name' => 'assign_to',
41
-		]);
41
+		] );
42 42
 		$this->renderField( 'text', [
43 43
 			'class' => 'widefat',
44 44
 			'label' => __( 'Enter any custom CSS classes here', 'site-reviews' ),
45 45
 			'name' => 'class',
46
-		]);
46
+		] );
47 47
 		$this->renderField( 'checkbox', [
48 48
 			'name' => 'hide',
49 49
 			'options' => [
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 				'terms' => __( 'Hide the terms field', 'site-reviews' ),
53 53
 				'title' => __( 'Hide the title field', 'site-reviews' ),
54 54
 			],
55
-		]);
55
+		] );
56 56
 	}
57 57
 
58 58
 	/**
Please login to merge, or discard this patch.
plugin/Widgets/SiteReviewsWidget.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@  discard block
 block discarded – undo
20 20
 			'class' => 'widefat',
21 21
 			'label' => __( 'Title', 'site-reviews' ),
22 22
 			'name' => 'title',
23
-		]);
23
+		] );
24 24
 		$this->renderField( 'number', [
25 25
 			'class' => 'small-text',
26 26
 			'default' => 5,
27 27
 			'label' => __( 'How many reviews would you like to display?', 'site-reviews' ),
28 28
 			'max' => 100,
29 29
 			'name' => 'count',
30
-		]);
30
+		] );
31 31
 		$this->renderField( 'select', [
32 32
 			'label' => __( 'What is the minimum rating to display?', 'site-reviews' ),
33 33
 			'name' => 'rating',
@@ -38,22 +38,22 @@  discard block
 block discarded – undo
38 38
 				'2' => sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ),
39 39
 				'1' => sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ),
40 40
 			],
41
-		]);
41
+		] );
42 42
 		if( count( glsr()->reviewTypes ) > 1 ) {
43 43
 			$this->renderField( 'select', [
44 44
 				'class' => 'widefat',
45 45
 				'label' => __( 'Which reviews would you like to display?', 'site-reviews' ),
46 46
 				'name' => 'display',
47 47
 				'options' => ['' => __( 'All Reviews', 'site-reviews' )] + glsr()->reviewTypes,
48
-			]);
48
+			] );
49 49
 		}
50
-		if( !empty( $terms )) {
50
+		if( !empty($terms) ) {
51 51
 			$this->renderField( 'select', [
52 52
 				'class' => 'widefat',
53 53
 				'label' => __( 'Limit reviews to this category', 'site-reviews' ),
54 54
 				'name' => 'category',
55 55
 				'options' => ['' => __( 'All Categories', 'site-reviews' )] + $terms,
56
-			]);
56
+			] );
57 57
 		}
58 58
 		$this->renderField( 'text', [
59 59
 			'class' => 'widefat',
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 			'description' => sprintf( __( "Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews' ), '<code>post_id</code>' ),
62 62
 			'label' => __( 'Limit reviews to those assigned to this page/post ID', 'site-reviews' ),
63 63
 			'name' => 'assigned_to',
64
-		]);
64
+		] );
65 65
 		$this->renderField( 'text', [
66 66
 			'class' => 'widefat',
67 67
 			'label' => __( 'Enter any custom CSS classes here', 'site-reviews' ),
68 68
 			'name' => 'class',
69
-		]);
69
+		] );
70 70
 		$this->renderField( 'checkbox', [
71 71
 			'name' => 'hide',
72 72
 			'options' => [
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 				'response' => __( 'Hide the review response?', 'site-reviews' ),
78 78
 				'title' => __( 'Hide the review title?', 'site-reviews' ),
79 79
 			],
80
-		]);
80
+		] );
81 81
 	}
82 82
 
83 83
 	/**
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function update( $newInstance, $oldInstance )
89 89
 	{
90
-		if( !is_numeric( $newInstance['count'] )) {
90
+		if( !is_numeric( $newInstance['count'] ) ) {
91 91
 			$newInstance['count'] = 10;
92 92
 		}
93
-		$newInstance['count'] = min( 50, max( 0, intval( $newInstance['count'] )));
93
+		$newInstance['count'] = min( 50, max( 0, intval( $newInstance['count'] ) ) );
94 94
 		return parent::update( $newInstance, $oldInstance );
95 95
 	}
96 96
 
Please login to merge, or discard this patch.
plugin/Widgets/Widget.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,13 +15,13 @@  discard block
 block discarded – undo
15 15
 	public function __construct( $idBase, $name, $values )
16 16
 	{
17 17
 		$controlOptions = $widgetOptions = [];
18
-		if( isset( $values['class'] )) {
18
+		if( isset($values['class']) ) {
19 19
 			$widgetOptions['classname'] = $values['class'];
20 20
 		}
21
-		if( isset( $values['description'] )) {
21
+		if( isset($values['description']) ) {
22 22
 			$widgetOptions['description'] = $values['description'];
23 23
 		}
24
-		if( isset( $values['width'] )) {
24
+		if( isset($values['width']) ) {
25 25
 			$controlOptions['width'] = $values['width'];
26 26
 		}
27 27
 		parent::__construct( $idBase, $name, $widgetOptions, $controlOptions );
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 	protected function renderField( $tag, array $args = [] )
35 35
 	{
36 36
 		$args = $this->normalizeFieldAttributes( $tag, $args );
37
-		$field = glsr( Builder::class )->{$tag}( $args['name'], $args );
37
+		$field = glsr( Builder::class )->{$tag}($args['name'], $args);
38 38
 		echo glsr( Builder::class )->div( $field, [
39 39
 			'class' => 'glsr-field',
40
-		]);
40
+		] );
41 41
 	}
42 42
 
43 43
 	/**
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	protected function normalizeFieldAttributes( $tag, array $args )
48 48
 	{
49
-		if( empty( $args['value'] )) {
49
+		if( empty($args['value']) ) {
50 50
 			$args['value'] = $this->widgetArgs[$args['name']];
51 51
 		}
52
-		if( empty( $this->widgetArgs['options'] ) && in_array( $tag, ['checkbox', 'radio'] )) {
52
+		if( empty($this->widgetArgs['options']) && in_array( $tag, ['checkbox', 'radio'] ) ) {
53 53
 			$args['checked'] = in_array( $args['value'], (array)$this->widgetArgs[$args['name']] );
54 54
 		}
55 55
 		$args['id'] = $this->get_field_id( $args['name'] );
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsFormShortcode.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@
 block discarded – undo
15 15
 	 */
16 16
 	protected function sanitize( array $args )
17 17
 	{
18
-		if( empty( $args['id'] )) {
19
-			$args['id'] = substr( md5( serialize( $args )), 0, 8 );
18
+		if( empty($args['id']) ) {
19
+			$args['id'] = substr( md5( serialize( $args ) ), 0, 8 );
20 20
 		}
21 21
 		return $args;
22 22
 	}
Please login to merge, or discard this patch.
plugin/Handlers/RegisterShortcodes.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@
 block discarded – undo
14 14
 	{
15 15
 		foreach( $command->shortcodes as $shortcode ) {
16 16
 			$shortcodeClass = glsr( Helper::class )->buildClassName( $shortcode.'-shortcode', 'Shortcodes' );
17
-			if( !class_exists( $shortcodeClass )) {
18
-				glsr_log()->error( sprintf( 'Class missing (%s)', $shortcodeClass ));
17
+			if( !class_exists( $shortcodeClass ) ) {
18
+				glsr_log()->error( sprintf( 'Class missing (%s)', $shortcodeClass ) );
19 19
 				continue;
20 20
 			}
21 21
 			add_shortcode( $shortcode, [glsr( $shortcodeClass ), 'buildShortcode'] );
Please login to merge, or discard this patch.
plugin/Handlers/RegisterWidgets.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@
 block discarded – undo
16 16
 		global $wp_widget_factory;
17 17
 		foreach( $command->widgets as $key => $values ) {
18 18
 			$widgetClass = glsr( Helper::class )->buildClassName( $key.'-widget', 'Widgets' );
19
-			if( !class_exists( $widgetClass )) {
20
-				glsr_log()->error( sprintf( 'Class missing (%s)', $widgetClass ));
19
+			if( !class_exists( $widgetClass ) ) {
20
+				glsr_log()->error( sprintf( 'Class missing (%s)', $widgetClass ) );
21 21
 				continue;
22 22
 			}
23 23
 			// Here we bypass register_widget() in order to pass our custom values to the widget
Please login to merge, or discard this patch.
plugin/Handlers/TogglePinned.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@
 block discarded – undo
12 12
 	 */
13 13
 	public function handle( Command $command )
14 14
 	{
15
-		if( !get_post( $command->id )) {
15
+		if( !get_post( $command->id ) ) {
16 16
 			return false;
17 17
 		}
18
-		if( is_null( $command->pinned )) {
18
+		if( is_null( $command->pinned ) ) {
19 19
 			$meta = get_post_meta( $command->id, 'pinned', true );
20 20
 			$command->pinned = !wp_validate_boolean( $meta );
21 21
 		}
Please login to merge, or discard this patch.
plugin/Controllers/Controller.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,9 @@
 block discarded – undo
15 15
 	 */
16 16
 	public function download( $filename, $content )
17 17
 	{
18
-		if( !current_user_can( Application::CAPABILITY ))return;
18
+		if( !current_user_can( Application::CAPABILITY )) {
19
+			return;
20
+		}
19 21
 		nocache_headers();
20 22
 		header( 'Content-Type: text/plain' );
21 23
 		header( 'Content-Disposition: attachment; filename="'.$filename.'"' );
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	 */
16 16
 	public function download( $filename, $content )
17 17
 	{
18
-		if( !current_user_can( Application::CAPABILITY ))return;
18
+		if( !current_user_can( Application::CAPABILITY ) )return;
19 19
 		nocache_headers();
20 20
 		header( 'Content-Type: text/plain' );
21 21
 		header( 'Content-Disposition: attachment; filename="'.$filename.'"' );
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	public function execute( $command )
32 32
 	{
33
-		$handlerClass = str_replace( 'Commands', 'Handlers', get_class( $command ));
34
-		if( !class_exists( $handlerClass )) {
33
+		$handlerClass = str_replace( 'Commands', 'Handlers', get_class( $command ) );
34
+		if( !class_exists( $handlerClass ) ) {
35 35
 			throw new InvalidArgumentException( 'Handler '.$handlerClass.' not found.' );
36 36
 		}
37 37
 		try {
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 		}
40 40
 		catch( Exception $e ) {
41 41
 			status_header( 400 );
42
-			glsr( Notice::class )->addError( new WP_Error( 'site_reviews_error', $e->getMessage() ));
42
+			glsr( Notice::class )->addError( new WP_Error( 'site_reviews_error', $e->getMessage() ) );
43 43
 			glsr_log()->error( $e->getMessage() );
44 44
 		}
45 45
 	}
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	protected function getPostId()
51 51
 	{
52
-		return intval( filter_input( INPUT_GET, 'post' ));
52
+		return intval( filter_input( INPUT_GET, 'post' ) );
53 53
 	}
54 54
 
55 55
 	/**
Please login to merge, or discard this patch.
plugin/Modules/Html/Partial.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 	public function build( $partialPath, array $args = [] )
14 14
 	{
15 15
 		$className = glsr( Helper::class )->buildClassName( $partialPath, 'Modules\Html\Partials' );
16
-		if( !class_exists( $className )) {
16
+		if( !class_exists( $className ) ) {
17 17
 			glsr_log()->error( 'Partial missing: '.$className );
18 18
 			return;
19 19
 		}
Please login to merge, or discard this patch.