Passed
Push — master ( af979f...1dfed5 )
by Paul
08:16 queued 04:12
created
plugin/Modules/Html/Template.php 2 patches
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -7,76 +7,76 @@
 block discarded – undo
7 7
 
8 8
 class Template
9 9
 {
10
-    /**
11
-     * @param string $templatePath
12
-     * @return void|string
13
-     */
14
-    public function build($templatePath, array $data = [])
15
-    {
16
-        $data = $this->normalize($data);
17
-        $path = Str::removePrefix('templates/', $templatePath);
18
-        $template = glsr()->build($templatePath, $data);
19
-        $template = apply_filters('site-reviews/build/template/'.$path, $template, $data);
20
-        $template = $this->interpolate($template, $data, $path);
21
-        $template = apply_filters('site-reviews/rendered/template', $template, $templatePath, $data);
22
-        $template = apply_filters('site-reviews/rendered/template/'.$path, $template, $data);
23
-        return $template;
24
-    }
10
+	/**
11
+	 * @param string $templatePath
12
+	 * @return void|string
13
+	 */
14
+	public function build($templatePath, array $data = [])
15
+	{
16
+		$data = $this->normalize($data);
17
+		$path = Str::removePrefix('templates/', $templatePath);
18
+		$template = glsr()->build($templatePath, $data);
19
+		$template = apply_filters('site-reviews/build/template/'.$path, $template, $data);
20
+		$template = $this->interpolate($template, $data, $path);
21
+		$template = apply_filters('site-reviews/rendered/template', $template, $templatePath, $data);
22
+		$template = apply_filters('site-reviews/rendered/template/'.$path, $template, $data);
23
+		return $template;
24
+	}
25 25
 
26
-    /**
27
-     * Interpolate context values into template placeholders.
28
-     * @param string $template
29
-     * @param string $templatePath
30
-     * @return string
31
-     */
32
-    public function interpolate($template, array $data = [], $templatePath)
33
-    {
34
-        $context = $this->normalizeContext(Arr::get($data, 'context', []));
35
-        $context = apply_filters('site-reviews/interpolate/'.$templatePath, $context, $template, $data);
36
-        foreach ($context as $key => $value) {
37
-            $template = strtr(
38
-                $template,
39
-                array_fill_keys(['{'.$key.'}', '{{ '.$key.' }}'], $value)
40
-            );
41
-        }
42
-        return trim($template);
43
-    }
26
+	/**
27
+	 * Interpolate context values into template placeholders.
28
+	 * @param string $template
29
+	 * @param string $templatePath
30
+	 * @return string
31
+	 */
32
+	public function interpolate($template, array $data = [], $templatePath)
33
+	{
34
+		$context = $this->normalizeContext(Arr::get($data, 'context', []));
35
+		$context = apply_filters('site-reviews/interpolate/'.$templatePath, $context, $template, $data);
36
+		foreach ($context as $key => $value) {
37
+			$template = strtr(
38
+				$template,
39
+				array_fill_keys(['{'.$key.'}', '{{ '.$key.' }}'], $value)
40
+			);
41
+		}
42
+		return trim($template);
43
+	}
44 44
 
45
-    /**
46
-     * @param string $templatePath
47
-     * @return void|string
48
-     */
49
-    public function render($templatePath, array $data = [])
50
-    {
51
-        echo $this->build($templatePath, $data);
52
-    }
45
+	/**
46
+	 * @param string $templatePath
47
+	 * @return void|string
48
+	 */
49
+	public function render($templatePath, array $data = [])
50
+	{
51
+		echo $this->build($templatePath, $data);
52
+	}
53 53
 
54
-    /**
55
-     * @return array
56
-     */
57
-    protected function normalize(array $data)
58
-    {
59
-        $arrayKeys = ['context', 'globals'];
60
-        $data = wp_parse_args($data, array_fill_keys($arrayKeys, []));
61
-        foreach ($arrayKeys as $key) {
62
-            if (is_array($data[$key])) {
63
-                continue;
64
-            }
65
-            $data[$key] = [];
66
-        }
67
-        return $data;
68
-    }
54
+	/**
55
+	 * @return array
56
+	 */
57
+	protected function normalize(array $data)
58
+	{
59
+		$arrayKeys = ['context', 'globals'];
60
+		$data = wp_parse_args($data, array_fill_keys($arrayKeys, []));
61
+		foreach ($arrayKeys as $key) {
62
+			if (is_array($data[$key])) {
63
+				continue;
64
+			}
65
+			$data[$key] = [];
66
+		}
67
+		return $data;
68
+	}
69 69
 
70
-    /**
71
-     * @return array
72
-     */
73
-    protected function normalizeContext(array $context)
74
-    {
75
-        $context = array_filter($context, function ($value) {
76
-            return !is_array($value) && !is_object($value);
77
-        });
78
-        return array_map(function ($value) {
79
-            return (string) $value;
80
-        }, $context);
81
-    }
70
+	/**
71
+	 * @return array
72
+	 */
73
+	protected function normalizeContext(array $context)
74
+	{
75
+		$context = array_filter($context, function ($value) {
76
+			return !is_array($value) && !is_object($value);
77
+		});
78
+		return array_map(function ($value) {
79
+			return (string) $value;
80
+		}, $context);
81
+	}
82 82
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@  discard block
 block discarded – undo
11 11
      * @param string $templatePath
12 12
      * @return void|string
13 13
      */
14
-    public function build($templatePath, array $data = [])
14
+    public function build( $templatePath, array $data = [] )
15 15
     {
16
-        $data = $this->normalize($data);
17
-        $path = Str::removePrefix('templates/', $templatePath);
18
-        $template = glsr()->build($templatePath, $data);
19
-        $template = apply_filters('site-reviews/build/template/'.$path, $template, $data);
20
-        $template = $this->interpolate($template, $data, $path);
21
-        $template = apply_filters('site-reviews/rendered/template', $template, $templatePath, $data);
22
-        $template = apply_filters('site-reviews/rendered/template/'.$path, $template, $data);
16
+        $data = $this->normalize( $data );
17
+        $path = Str::removePrefix( 'templates/', $templatePath );
18
+        $template = glsr()->build( $templatePath, $data );
19
+        $template = apply_filters( 'site-reviews/build/template/'.$path, $template, $data );
20
+        $template = $this->interpolate( $template, $data, $path );
21
+        $template = apply_filters( 'site-reviews/rendered/template', $template, $templatePath, $data );
22
+        $template = apply_filters( 'site-reviews/rendered/template/'.$path, $template, $data );
23 23
         return $template;
24 24
     }
25 25
 
@@ -29,37 +29,37 @@  discard block
 block discarded – undo
29 29
      * @param string $templatePath
30 30
      * @return string
31 31
      */
32
-    public function interpolate($template, array $data = [], $templatePath)
32
+    public function interpolate( $template, array $data = [], $templatePath )
33 33
     {
34
-        $context = $this->normalizeContext(Arr::get($data, 'context', []));
35
-        $context = apply_filters('site-reviews/interpolate/'.$templatePath, $context, $template, $data);
36
-        foreach ($context as $key => $value) {
34
+        $context = $this->normalizeContext( Arr::get( $data, 'context', [] ) );
35
+        $context = apply_filters( 'site-reviews/interpolate/'.$templatePath, $context, $template, $data );
36
+        foreach( $context as $key => $value ) {
37 37
             $template = strtr(
38 38
                 $template,
39
-                array_fill_keys(['{'.$key.'}', '{{ '.$key.' }}'], $value)
39
+                array_fill_keys( ['{'.$key.'}', '{{ '.$key.' }}'], $value )
40 40
             );
41 41
         }
42
-        return trim($template);
42
+        return trim( $template );
43 43
     }
44 44
 
45 45
     /**
46 46
      * @param string $templatePath
47 47
      * @return void|string
48 48
      */
49
-    public function render($templatePath, array $data = [])
49
+    public function render( $templatePath, array $data = [] )
50 50
     {
51
-        echo $this->build($templatePath, $data);
51
+        echo $this->build( $templatePath, $data );
52 52
     }
53 53
 
54 54
     /**
55 55
      * @return array
56 56
      */
57
-    protected function normalize(array $data)
57
+    protected function normalize( array $data )
58 58
     {
59 59
         $arrayKeys = ['context', 'globals'];
60
-        $data = wp_parse_args($data, array_fill_keys($arrayKeys, []));
61
-        foreach ($arrayKeys as $key) {
62
-            if (is_array($data[$key])) {
60
+        $data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] ) );
61
+        foreach( $arrayKeys as $key ) {
62
+            if( is_array( $data[$key] ) ) {
63 63
                 continue;
64 64
             }
65 65
             $data[$key] = [];
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
     /**
71 71
      * @return array
72 72
      */
73
-    protected function normalizeContext(array $context)
73
+    protected function normalizeContext( array $context )
74 74
     {
75
-        $context = array_filter($context, function ($value) {
76
-            return !is_array($value) && !is_object($value);
75
+        $context = array_filter( $context, function( $value ) {
76
+            return !is_array( $value ) && !is_object( $value );
77 77
         });
78
-        return array_map(function ($value) {
79
-            return (string) $value;
80
-        }, $context);
78
+        return array_map( function( $value ) {
79
+            return (string)$value;
80
+        }, $context );
81 81
     }
82 82
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/Pagination.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -10,52 +10,52 @@
 block discarded – undo
10 10
 
11 11
 class Pagination implements PartialContract
12 12
 {
13
-    /**
14
-     * @var array
15
-     */
16
-    protected $args;
13
+	/**
14
+	 * @var array
15
+	 */
16
+	protected $args;
17 17
 
18
-    /**
19
-     * @return string
20
-     */
21
-    public function build(array $args = [])
22
-    {
23
-        $this->args = $this->normalize($args);
24
-        if ($this->args['total'] < 2) {
25
-            return '';
26
-        }
27
-        return glsr(Template::class)->build('templates/pagination', [
28
-            'context' => [
29
-                'links' => apply_filters('site-reviews/paginate_links', $this->buildLinks(), $this->args),
30
-                'loader' => '<div class="glsr-loader"></div>',
31
-                'screen_reader_text' => __('Site Reviews navigation', 'site-reviews'),
32
-            ],
33
-        ]);
34
-    }
18
+	/**
19
+	 * @return string
20
+	 */
21
+	public function build(array $args = [])
22
+	{
23
+		$this->args = $this->normalize($args);
24
+		if ($this->args['total'] < 2) {
25
+			return '';
26
+		}
27
+		return glsr(Template::class)->build('templates/pagination', [
28
+			'context' => [
29
+				'links' => apply_filters('site-reviews/paginate_links', $this->buildLinks(), $this->args),
30
+				'loader' => '<div class="glsr-loader"></div>',
31
+				'screen_reader_text' => __('Site Reviews navigation', 'site-reviews'),
32
+			],
33
+		]);
34
+	}
35 35
 
36
-    /**
37
-     * @return string
38
-     */
39
-    protected function buildLinks()
40
-    {
41
-        $args = glsr(Style::class)->paginationArgs($this->args);
42
-        if ('array' == $args['type']) {
43
-            $args['type'] = 'plain';
44
-        }
45
-        return paginate_links($args);
46
-    }
36
+	/**
37
+	 * @return string
38
+	 */
39
+	protected function buildLinks()
40
+	{
41
+		$args = glsr(Style::class)->paginationArgs($this->args);
42
+		if ('array' == $args['type']) {
43
+			$args['type'] = 'plain';
44
+		}
45
+		return paginate_links($args);
46
+	}
47 47
 
48
-    /**
49
-     * @return array
50
-     */
51
-    protected function normalize(array $args)
52
-    {
53
-        if ($baseUrl = Arr::get($args, 'baseUrl')) {
54
-            $args['base'] = $baseUrl.'%_%';
55
-        }
56
-        return wp_parse_args(array_filter($args), [
57
-            'current' => glsr(QueryBuilder::class)->getPaged(),
58
-            'total' => 1,
59
-        ]);
60
-    }
48
+	/**
49
+	 * @return array
50
+	 */
51
+	protected function normalize(array $args)
52
+	{
53
+		if ($baseUrl = Arr::get($args, 'baseUrl')) {
54
+			$args['base'] = $baseUrl.'%_%';
55
+		}
56
+		return wp_parse_args(array_filter($args), [
57
+			'current' => glsr(QueryBuilder::class)->getPaged(),
58
+			'total' => 1,
59
+		]);
60
+	}
61 61
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -18,19 +18,19 @@  discard block
 block discarded – undo
18 18
     /**
19 19
      * @return string
20 20
      */
21
-    public function build(array $args = [])
21
+    public function build( array $args = [] )
22 22
     {
23
-        $this->args = $this->normalize($args);
24
-        if ($this->args['total'] < 2) {
23
+        $this->args = $this->normalize( $args );
24
+        if( $this->args['total'] < 2 ) {
25 25
             return '';
26 26
         }
27
-        return glsr(Template::class)->build('templates/pagination', [
27
+        return glsr( Template::class )->build( 'templates/pagination', [
28 28
             'context' => [
29
-                'links' => apply_filters('site-reviews/paginate_links', $this->buildLinks(), $this->args),
29
+                'links' => apply_filters( 'site-reviews/paginate_links', $this->buildLinks(), $this->args ),
30 30
                 'loader' => '<div class="glsr-loader"></div>',
31
-                'screen_reader_text' => __('Site Reviews navigation', 'site-reviews'),
31
+                'screen_reader_text' => __( 'Site Reviews navigation', 'site-reviews' ),
32 32
             ],
33
-        ]);
33
+        ] );
34 34
     }
35 35
 
36 36
     /**
@@ -38,24 +38,24 @@  discard block
 block discarded – undo
38 38
      */
39 39
     protected function buildLinks()
40 40
     {
41
-        $args = glsr(Style::class)->paginationArgs($this->args);
42
-        if ('array' == $args['type']) {
41
+        $args = glsr( Style::class )->paginationArgs( $this->args );
42
+        if( 'array' == $args['type'] ) {
43 43
             $args['type'] = 'plain';
44 44
         }
45
-        return paginate_links($args);
45
+        return paginate_links( $args );
46 46
     }
47 47
 
48 48
     /**
49 49
      * @return array
50 50
      */
51
-    protected function normalize(array $args)
51
+    protected function normalize( array $args )
52 52
     {
53
-        if ($baseUrl = Arr::get($args, 'baseUrl')) {
53
+        if( $baseUrl = Arr::get( $args, 'baseUrl' ) ) {
54 54
             $args['base'] = $baseUrl.'%_%';
55 55
         }
56
-        return wp_parse_args(array_filter($args), [
57
-            'current' => glsr(QueryBuilder::class)->getPaged(),
56
+        return wp_parse_args( array_filter( $args ), [
57
+            'current' => glsr( QueryBuilder::class )->getPaged(),
58 58
             'total' => 1,
59
-        ]);
59
+        ] );
60 60
     }
61 61
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/ReviewHtml.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -7,48 +7,48 @@
 block discarded – undo
7 7
 
8 8
 class ReviewHtml extends ArrayObject
9 9
 {
10
-    /**
11
-     * @var Review
12
-     */
13
-    public $review;
10
+	/**
11
+	 * @var Review
12
+	 */
13
+	public $review;
14 14
 
15
-    /**
16
-     * @var array
17
-     */
18
-    public $values;
15
+	/**
16
+	 * @var array
17
+	 */
18
+	public $values;
19 19
 
20
-    public function __construct(Review $review, array $values = [])
21
-    {
22
-        $this->review = $review;
23
-        $this->values = $values;
24
-        parent::__construct($values, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
25
-    }
20
+	public function __construct(Review $review, array $values = [])
21
+	{
22
+		$this->review = $review;
23
+		$this->values = $values;
24
+		parent::__construct($values, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
25
+	}
26 26
 
27
-    /**
28
-     * @return string|void
29
-     */
30
-    public function __toString()
31
-    {
32
-        if (empty($this->values)) {
33
-            return;
34
-        }
35
-        return glsr(Template::class)->build('templates/review', [
36
-            'context' => $this->values,
37
-            'review' => $this->review,
38
-        ]);
39
-    }
27
+	/**
28
+	 * @return string|void
29
+	 */
30
+	public function __toString()
31
+	{
32
+		if (empty($this->values)) {
33
+			return;
34
+		}
35
+		return glsr(Template::class)->build('templates/review', [
36
+			'context' => $this->values,
37
+			'review' => $this->review,
38
+		]);
39
+	}
40 40
 
41
-    /**
42
-     * @param mixed $key
43
-     * @return mixed
44
-     */
45
-    public function offsetGet($key)
46
-    {
47
-        if (array_key_exists($key, $this->values)) {
48
-            return $this->values[$key];
49
-        }
50
-        return property_exists($this, $key)
51
-            ? $this->$key
52
-            : null;
53
-    }
41
+	/**
42
+	 * @param mixed $key
43
+	 * @return mixed
44
+	 */
45
+	public function offsetGet($key)
46
+	{
47
+		if (array_key_exists($key, $this->values)) {
48
+			return $this->values[$key];
49
+		}
50
+		return property_exists($this, $key)
51
+			? $this->$key
52
+			: null;
53
+	}
54 54
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
      */
18 18
     public $values;
19 19
 
20
-    public function __construct(Review $review, array $values = [])
20
+    public function __construct( Review $review, array $values = [] )
21 21
     {
22 22
         $this->review = $review;
23 23
         $this->values = $values;
24
-        parent::__construct($values, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
24
+        parent::__construct( $values, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS );
25 25
     }
26 26
 
27 27
     /**
@@ -29,25 +29,25 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public function __toString()
31 31
     {
32
-        if (empty($this->values)) {
32
+        if( empty($this->values) ) {
33 33
             return;
34 34
         }
35
-        return glsr(Template::class)->build('templates/review', [
35
+        return glsr( Template::class )->build( 'templates/review', [
36 36
             'context' => $this->values,
37 37
             'review' => $this->review,
38
-        ]);
38
+        ] );
39 39
     }
40 40
 
41 41
     /**
42 42
      * @param mixed $key
43 43
      * @return mixed
44 44
      */
45
-    public function offsetGet($key)
45
+    public function offsetGet( $key )
46 46
     {
47
-        if (array_key_exists($key, $this->values)) {
47
+        if( array_key_exists( $key, $this->values ) ) {
48 48
             return $this->values[$key];
49 49
         }
50
-        return property_exists($this, $key)
50
+        return property_exists( $this, $key )
51 51
             ? $this->$key
52 52
             : null;
53 53
     }
Please login to merge, or discard this patch.
plugin/Modules/Html/ReviewsHtml.php 2 patches
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -8,135 +8,135 @@
 block discarded – undo
8 8
 
9 9
 class ReviewsHtml extends ArrayObject
10 10
 {
11
-    /**
12
-     * @var array
13
-     */
14
-    public $args;
11
+	/**
12
+	 * @var array
13
+	 */
14
+	public $args;
15 15
 
16
-    /**
17
-     * @var int
18
-     */
19
-    public $max_num_pages;
16
+	/**
17
+	 * @var int
18
+	 */
19
+	public $max_num_pages;
20 20
 
21
-    /**
22
-     * @var string
23
-     */
24
-    public $pagination;
21
+	/**
22
+	 * @var string
23
+	 */
24
+	public $pagination;
25 25
 
26
-    /**
27
-     * @var array
28
-     */
29
-    public $reviews;
26
+	/**
27
+	 * @var array
28
+	 */
29
+	public $reviews;
30 30
 
31
-    public function __construct(array $renderedReviews, $maxPageCount, array $args)
32
-    {
33
-        $this->args = $args;
34
-        $this->max_num_pages = $maxPageCount;
35
-        $this->reviews = $renderedReviews;
36
-        $this->pagination = $this->buildPagination();
37
-        parent::__construct($renderedReviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
38
-    }
31
+	public function __construct(array $renderedReviews, $maxPageCount, array $args)
32
+	{
33
+		$this->args = $args;
34
+		$this->max_num_pages = $maxPageCount;
35
+		$this->reviews = $renderedReviews;
36
+		$this->pagination = $this->buildPagination();
37
+		parent::__construct($renderedReviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
38
+	}
39 39
 
40
-    /**
41
-     * @return string
42
-     */
43
-    public function __toString()
44
-    {
45
-        return glsr(Template::class)->build('templates/reviews', [
46
-            'args' => $this->args,
47
-            'context' => [
48
-                'assigned_to' => $this->args['assigned_to'],
49
-                'category' => $this->args['category'],
50
-                'class' => $this->getClass(),
51
-                'id' => $this->args['id'],
52
-                'pagination' => $this->getPagination(),
53
-                'reviews' => $this->getReviews(),
54
-            ],
55
-        ]);
56
-    }
40
+	/**
41
+	 * @return string
42
+	 */
43
+	public function __toString()
44
+	{
45
+		return glsr(Template::class)->build('templates/reviews', [
46
+			'args' => $this->args,
47
+			'context' => [
48
+				'assigned_to' => $this->args['assigned_to'],
49
+				'category' => $this->args['category'],
50
+				'class' => $this->getClass(),
51
+				'id' => $this->args['id'],
52
+				'pagination' => $this->getPagination(),
53
+				'reviews' => $this->getReviews(),
54
+			],
55
+		]);
56
+	}
57 57
 
58
-    /**
59
-     * @return string
60
-     */
61
-    public function getPagination()
62
-    {
63
-        return wp_validate_boolean($this->args['pagination'])
64
-            ? $this->pagination
65
-            : '';
66
-    }
58
+	/**
59
+	 * @return string
60
+	 */
61
+	public function getPagination()
62
+	{
63
+		return wp_validate_boolean($this->args['pagination'])
64
+			? $this->pagination
65
+			: '';
66
+	}
67 67
 
68
-    /**
69
-     * @return string
70
-     */
71
-    public function getReviews()
72
-    {
73
-        $html = empty($this->reviews)
74
-            ? $this->getReviewsFallback()
75
-            : implode(PHP_EOL, $this->reviews);
76
-        $wrapper = '<div class="glsr-reviews">%s</div>';
77
-        $wrapper = apply_filters('site-reviews/reviews/reviews-wrapper', $wrapper);
78
-        return sprintf($wrapper, $html);
79
-    }
68
+	/**
69
+	 * @return string
70
+	 */
71
+	public function getReviews()
72
+	{
73
+		$html = empty($this->reviews)
74
+			? $this->getReviewsFallback()
75
+			: implode(PHP_EOL, $this->reviews);
76
+		$wrapper = '<div class="glsr-reviews">%s</div>';
77
+		$wrapper = apply_filters('site-reviews/reviews/reviews-wrapper', $wrapper);
78
+		return sprintf($wrapper, $html);
79
+	}
80 80
 
81
-    /**
82
-     * @param mixed $key
83
-     * @return mixed
84
-     */
85
-    public function offsetGet($key)
86
-    {
87
-        if ('navigation' == $key) {
88
-            glsr()->deprecated[] = 'The $reviewsHtml->navigation property has been been deprecated. Please use the $reviewsHtml->pagination property instead.';
89
-            return $this->pagination;
90
-        }
91
-        if (array_key_exists($key, $this->reviews)) {
92
-            return $this->reviews[$key];
93
-        }
94
-        return property_exists($this, $key)
95
-            ? $this->$key
96
-            : null;
97
-    }
81
+	/**
82
+	 * @param mixed $key
83
+	 * @return mixed
84
+	 */
85
+	public function offsetGet($key)
86
+	{
87
+		if ('navigation' == $key) {
88
+			glsr()->deprecated[] = 'The $reviewsHtml->navigation property has been been deprecated. Please use the $reviewsHtml->pagination property instead.';
89
+			return $this->pagination;
90
+		}
91
+		if (array_key_exists($key, $this->reviews)) {
92
+			return $this->reviews[$key];
93
+		}
94
+		return property_exists($this, $key)
95
+			? $this->$key
96
+			: null;
97
+	}
98 98
 
99
-    /**
100
-     * @return string
101
-     */
102
-    protected function buildPagination()
103
-    {
104
-        $html = glsr(Partial::class)->build('pagination', [
105
-            'baseUrl' => Arr::get($this->args, 'pagedUrl'),
106
-            'current' => Arr::get($this->args, 'paged'),
107
-            'total' => $this->max_num_pages,
108
-        ]);
109
-        $html.= sprintf('<glsr-pagination hidden data-atts=\'%s\'></glsr-pagination>', $this->args['json']);
110
-        $wrapper = '<div class="glsr-pagination">%s</div>';
111
-        $wrapper = apply_filters('site-reviews/reviews/pagination-wrapper', $wrapper);
112
-        return sprintf($wrapper, $html);
113
-    }
99
+	/**
100
+	 * @return string
101
+	 */
102
+	protected function buildPagination()
103
+	{
104
+		$html = glsr(Partial::class)->build('pagination', [
105
+			'baseUrl' => Arr::get($this->args, 'pagedUrl'),
106
+			'current' => Arr::get($this->args, 'paged'),
107
+			'total' => $this->max_num_pages,
108
+		]);
109
+		$html.= sprintf('<glsr-pagination hidden data-atts=\'%s\'></glsr-pagination>', $this->args['json']);
110
+		$wrapper = '<div class="glsr-pagination">%s</div>';
111
+		$wrapper = apply_filters('site-reviews/reviews/pagination-wrapper', $wrapper);
112
+		return sprintf($wrapper, $html);
113
+	}
114 114
 
115
-    /**
116
-     * @return string
117
-     */
118
-    protected function getClass()
119
-    {
120
-        $defaults = [
121
-            'glsr-default',
122
-        ];
123
-        if ('ajax' == $this->args['pagination']) {
124
-            $defaults[] = 'glsr-ajax-pagination';
125
-        }
126
-        $classes = explode(' ', $this->args['class']);
127
-        $classes = array_unique(array_merge($defaults, array_filter($classes)));
128
-        return implode(' ', $classes);
129
-    }
115
+	/**
116
+	 * @return string
117
+	 */
118
+	protected function getClass()
119
+	{
120
+		$defaults = [
121
+			'glsr-default',
122
+		];
123
+		if ('ajax' == $this->args['pagination']) {
124
+			$defaults[] = 'glsr-ajax-pagination';
125
+		}
126
+		$classes = explode(' ', $this->args['class']);
127
+		$classes = array_unique(array_merge($defaults, array_filter($classes)));
128
+		return implode(' ', $classes);
129
+	}
130 130
 
131
-    /**
132
-     * @return string
133
-     */
134
-    protected function getReviewsFallback()
135
-    {
136
-        if (empty($this->args['fallback']) && glsr(OptionManager::class)->getBool('settings.reviews.fallback')) {
137
-            $this->args['fallback'] = __('There are no reviews yet. Be the first one to write one.', 'site-reviews');
138
-        }
139
-        $fallback = '<p class="glsr-no-margins">'.$this->args['fallback'].'</p>';
140
-        return apply_filters('site-reviews/reviews/fallback', $fallback, $this->args);
141
-    }
131
+	/**
132
+	 * @return string
133
+	 */
134
+	protected function getReviewsFallback()
135
+	{
136
+		if (empty($this->args['fallback']) && glsr(OptionManager::class)->getBool('settings.reviews.fallback')) {
137
+			$this->args['fallback'] = __('There are no reviews yet. Be the first one to write one.', 'site-reviews');
138
+		}
139
+		$fallback = '<p class="glsr-no-margins">'.$this->args['fallback'].'</p>';
140
+		return apply_filters('site-reviews/reviews/fallback', $fallback, $this->args);
141
+	}
142 142
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public $reviews;
30 30
 
31
-    public function __construct(array $renderedReviews, $maxPageCount, array $args)
31
+    public function __construct( array $renderedReviews, $maxPageCount, array $args )
32 32
     {
33 33
         $this->args = $args;
34 34
         $this->max_num_pages = $maxPageCount;
35 35
         $this->reviews = $renderedReviews;
36 36
         $this->pagination = $this->buildPagination();
37
-        parent::__construct($renderedReviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
37
+        parent::__construct( $renderedReviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS );
38 38
     }
39 39
 
40 40
     /**
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function __toString()
44 44
     {
45
-        return glsr(Template::class)->build('templates/reviews', [
45
+        return glsr( Template::class )->build( 'templates/reviews', [
46 46
             'args' => $this->args,
47 47
             'context' => [
48 48
                 'assigned_to' => $this->args['assigned_to'],
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                 'pagination' => $this->getPagination(),
53 53
                 'reviews' => $this->getReviews(),
54 54
             ],
55
-        ]);
55
+        ] );
56 56
     }
57 57
 
58 58
     /**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function getPagination()
62 62
     {
63
-        return wp_validate_boolean($this->args['pagination'])
63
+        return wp_validate_boolean( $this->args['pagination'] )
64 64
             ? $this->pagination
65 65
             : '';
66 66
     }
@@ -72,26 +72,26 @@  discard block
 block discarded – undo
72 72
     {
73 73
         $html = empty($this->reviews)
74 74
             ? $this->getReviewsFallback()
75
-            : implode(PHP_EOL, $this->reviews);
75
+            : implode( PHP_EOL, $this->reviews );
76 76
         $wrapper = '<div class="glsr-reviews">%s</div>';
77
-        $wrapper = apply_filters('site-reviews/reviews/reviews-wrapper', $wrapper);
78
-        return sprintf($wrapper, $html);
77
+        $wrapper = apply_filters( 'site-reviews/reviews/reviews-wrapper', $wrapper );
78
+        return sprintf( $wrapper, $html );
79 79
     }
80 80
 
81 81
     /**
82 82
      * @param mixed $key
83 83
      * @return mixed
84 84
      */
85
-    public function offsetGet($key)
85
+    public function offsetGet( $key )
86 86
     {
87
-        if ('navigation' == $key) {
87
+        if( 'navigation' == $key ) {
88 88
             glsr()->deprecated[] = 'The $reviewsHtml->navigation property has been been deprecated. Please use the $reviewsHtml->pagination property instead.';
89 89
             return $this->pagination;
90 90
         }
91
-        if (array_key_exists($key, $this->reviews)) {
91
+        if( array_key_exists( $key, $this->reviews ) ) {
92 92
             return $this->reviews[$key];
93 93
         }
94
-        return property_exists($this, $key)
94
+        return property_exists( $this, $key )
95 95
             ? $this->$key
96 96
             : null;
97 97
     }
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
      */
102 102
     protected function buildPagination()
103 103
     {
104
-        $html = glsr(Partial::class)->build('pagination', [
105
-            'baseUrl' => Arr::get($this->args, 'pagedUrl'),
106
-            'current' => Arr::get($this->args, 'paged'),
104
+        $html = glsr( Partial::class )->build( 'pagination', [
105
+            'baseUrl' => Arr::get( $this->args, 'pagedUrl' ),
106
+            'current' => Arr::get( $this->args, 'paged' ),
107 107
             'total' => $this->max_num_pages,
108
-        ]);
109
-        $html.= sprintf('<glsr-pagination hidden data-atts=\'%s\'></glsr-pagination>', $this->args['json']);
108
+        ] );
109
+        $html .= sprintf( '<glsr-pagination hidden data-atts=\'%s\'></glsr-pagination>', $this->args['json'] );
110 110
         $wrapper = '<div class="glsr-pagination">%s</div>';
111
-        $wrapper = apply_filters('site-reviews/reviews/pagination-wrapper', $wrapper);
112
-        return sprintf($wrapper, $html);
111
+        $wrapper = apply_filters( 'site-reviews/reviews/pagination-wrapper', $wrapper );
112
+        return sprintf( $wrapper, $html );
113 113
     }
114 114
 
115 115
     /**
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
         $defaults = [
121 121
             'glsr-default',
122 122
         ];
123
-        if ('ajax' == $this->args['pagination']) {
123
+        if( 'ajax' == $this->args['pagination'] ) {
124 124
             $defaults[] = 'glsr-ajax-pagination';
125 125
         }
126
-        $classes = explode(' ', $this->args['class']);
127
-        $classes = array_unique(array_merge($defaults, array_filter($classes)));
128
-        return implode(' ', $classes);
126
+        $classes = explode( ' ', $this->args['class'] );
127
+        $classes = array_unique( array_merge( $defaults, array_filter( $classes ) ) );
128
+        return implode( ' ', $classes );
129 129
     }
130 130
 
131 131
     /**
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
      */
134 134
     protected function getReviewsFallback()
135 135
     {
136
-        if (empty($this->args['fallback']) && glsr(OptionManager::class)->getBool('settings.reviews.fallback')) {
137
-            $this->args['fallback'] = __('There are no reviews yet. Be the first one to write one.', 'site-reviews');
136
+        if( empty($this->args['fallback']) && glsr( OptionManager::class )->getBool( 'settings.reviews.fallback' ) ) {
137
+            $this->args['fallback'] = __( 'There are no reviews yet. Be the first one to write one.', 'site-reviews' );
138 138
         }
139 139
         $fallback = '<p class="glsr-no-margins">'.$this->args['fallback'].'</p>';
140
-        return apply_filters('site-reviews/reviews/fallback', $fallback, $this->args);
140
+        return apply_filters( 'site-reviews/reviews/fallback', $fallback, $this->args );
141 141
     }
142 142
 }
Please login to merge, or discard this patch.
plugin/Contracts/PartialContract.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 
5 5
 interface PartialContract
6 6
 {
7
-    /**
8
-     * @return string
9
-     */
10
-    public function build(array $args = []);
7
+	/**
8
+	 * @return string
9
+	 */
10
+	public function build(array $args = []);
11 11
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,5 +7,5 @@
 block discarded – undo
7 7
     /**
8 8
      * @return string
9 9
      */
10
-    public function build(array $args = []);
10
+    public function build( array $args = [] );
11 11
 }
Please login to merge, or discard this patch.
uninstall.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 require_once $file;
7 7
 
8 8
 if (!(new GL_Plugin_Check_v4($file))->isValid()) {
9
-    return;
9
+	return;
10 10
 }
11 11
 delete_option(GeminiLabs\SiteReviews\Database\OptionManager::databaseKey(3));
12 12
 delete_option(GeminiLabs\SiteReviews\Database\OptionManager::databaseKey(4));
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-defined('WP_UNINSTALL_PLUGIN') || die;
3
+defined( 'WP_UNINSTALL_PLUGIN' ) || die;
4 4
 
5 5
 $file = __DIR__.'/site-reviews.php';
6 6
 require_once $file;
7 7
 
8
-if (!(new GL_Plugin_Check_v4($file))->isValid()) {
8
+if( !(new GL_Plugin_Check_v4( $file ))->isValid() ) {
9 9
     return;
10 10
 }
11
-delete_option(GeminiLabs\SiteReviews\Database\OptionManager::databaseKey(3));
12
-delete_option(GeminiLabs\SiteReviews\Database\OptionManager::databaseKey(4));
13
-delete_option('_glsr_rebusify');
14
-delete_option('widget_'.glsr()->id.'_site-reviews');
15
-delete_option('widget_'.glsr()->id.'_site-reviews-form');
16
-delete_option('widget_'.glsr()->id.'_site-reviews-summary');
17
-delete_transient(glsr()->id.'_cloudflare_ips');
18
-delete_transient(glsr()->id.'_remote_post_test');
19
-wp_cache_delete(glsr()->id);
11
+delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey( 3 ) );
12
+delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey( 4 ) );
13
+delete_option( '_glsr_rebusify' );
14
+delete_option( 'widget_'.glsr()->id.'_site-reviews' );
15
+delete_option( 'widget_'.glsr()->id.'_site-reviews-form' );
16
+delete_option( 'widget_'.glsr()->id.'_site-reviews-summary' );
17
+delete_transient( glsr()->id.'_cloudflare_ips' );
18
+delete_transient( glsr()->id.'_remote_post_test' );
19
+wp_cache_delete( glsr()->id );
20 20
 
21 21
 global $wpdb;
22 22
 
23
-$wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key = '_glsr_notices'");
23
+$wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key = '_glsr_notices'" );
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/StarRating.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -8,54 +8,54 @@
 block discarded – undo
8 8
 
9 9
 class StarRating implements PartialContract
10 10
 {
11
-    protected $prefix;
12
-    protected $rating;
11
+	protected $prefix;
12
+	protected $rating;
13 13
 
14
-    /**
15
-     * @return string
16
-     */
17
-    public function build(array $args = [])
18
-    {
19
-        $this->setProperties($args);
20
-        $fullStars = intval(floor($this->rating));
21
-        $halfStars = intval(ceil($this->rating - $fullStars));
22
-        $emptyStars = max(0, glsr()->constant('MAX_RATING', Rating::class) - $fullStars - $halfStars);
23
-        return glsr(Template::class)->build('templates/rating/stars', [
24
-            'context' => [
25
-                'empty_stars' => $this->getTemplate('empty-star', $emptyStars),
26
-                'full_stars' => $this->getTemplate('full-star', $fullStars),
27
-                'half_stars' => $this->getTemplate('half-star', $halfStars),
28
-                'prefix' => $this->prefix,
29
-                'title' => sprintf(__('%s rating', 'site-reviews'), number_format_i18n($this->rating, 1)),
30
-            ],
31
-        ]);
32
-    }
14
+	/**
15
+	 * @return string
16
+	 */
17
+	public function build(array $args = [])
18
+	{
19
+		$this->setProperties($args);
20
+		$fullStars = intval(floor($this->rating));
21
+		$halfStars = intval(ceil($this->rating - $fullStars));
22
+		$emptyStars = max(0, glsr()->constant('MAX_RATING', Rating::class) - $fullStars - $halfStars);
23
+		return glsr(Template::class)->build('templates/rating/stars', [
24
+			'context' => [
25
+				'empty_stars' => $this->getTemplate('empty-star', $emptyStars),
26
+				'full_stars' => $this->getTemplate('full-star', $fullStars),
27
+				'half_stars' => $this->getTemplate('half-star', $halfStars),
28
+				'prefix' => $this->prefix,
29
+				'title' => sprintf(__('%s rating', 'site-reviews'), number_format_i18n($this->rating, 1)),
30
+			],
31
+		]);
32
+	}
33 33
 
34
-    /**
35
-     * @param string $templateName
36
-     * @param int $timesRepeated
37
-     * @return string
38
-     */
39
-    protected function getTemplate($templateName, $timesRepeated)
40
-    {
41
-        $template = glsr(Template::class)->build('templates/rating/'.$templateName, [
42
-            'context' => [
43
-                'prefix' => $this->prefix,
44
-            ],
45
-        ]);
46
-        return str_repeat($template, $timesRepeated);
47
-    }
34
+	/**
35
+	 * @param string $templateName
36
+	 * @param int $timesRepeated
37
+	 * @return string
38
+	 */
39
+	protected function getTemplate($templateName, $timesRepeated)
40
+	{
41
+		$template = glsr(Template::class)->build('templates/rating/'.$templateName, [
42
+			'context' => [
43
+				'prefix' => $this->prefix,
44
+			],
45
+		]);
46
+		return str_repeat($template, $timesRepeated);
47
+	}
48 48
 
49
-    /**
50
-     * @return array
51
-     */
52
-    protected function setProperties(array $args)
53
-    {
54
-        $args = wp_parse_args($args, [
55
-            'prefix' => glsr()->isAdmin() ? '' : 'glsr-',
56
-            'rating' => 0,
57
-        ]);
58
-        $this->prefix = $args['prefix'];
59
-        $this->rating = (float) str_replace(',', '.', $args['rating']);
60
-    }
49
+	/**
50
+	 * @return array
51
+	 */
52
+	protected function setProperties(array $args)
53
+	{
54
+		$args = wp_parse_args($args, [
55
+			'prefix' => glsr()->isAdmin() ? '' : 'glsr-',
56
+			'rating' => 0,
57
+		]);
58
+		$this->prefix = $args['prefix'];
59
+		$this->rating = (float) str_replace(',', '.', $args['rating']);
60
+	}
61 61
 }
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@  discard block
 block discarded – undo
14 14
     /**
15 15
      * @return string
16 16
      */
17
-    public function build(array $args = [])
17
+    public function build( array $args = [] )
18 18
     {
19
-        $this->setProperties($args);
20
-        $fullStars = intval(floor($this->rating));
21
-        $halfStars = intval(ceil($this->rating - $fullStars));
22
-        $emptyStars = max(0, glsr()->constant('MAX_RATING', Rating::class) - $fullStars - $halfStars);
23
-        return glsr(Template::class)->build('templates/rating/stars', [
19
+        $this->setProperties( $args );
20
+        $fullStars = intval( floor( $this->rating ) );
21
+        $halfStars = intval( ceil( $this->rating - $fullStars ) );
22
+        $emptyStars = max( 0, glsr()->constant( 'MAX_RATING', Rating::class ) - $fullStars - $halfStars );
23
+        return glsr( Template::class )->build( 'templates/rating/stars', [
24 24
             'context' => [
25
-                'empty_stars' => $this->getTemplate('empty-star', $emptyStars),
26
-                'full_stars' => $this->getTemplate('full-star', $fullStars),
27
-                'half_stars' => $this->getTemplate('half-star', $halfStars),
25
+                'empty_stars' => $this->getTemplate( 'empty-star', $emptyStars ),
26
+                'full_stars' => $this->getTemplate( 'full-star', $fullStars ),
27
+                'half_stars' => $this->getTemplate( 'half-star', $halfStars ),
28 28
                 'prefix' => $this->prefix,
29
-                'title' => sprintf(__('%s rating', 'site-reviews'), number_format_i18n($this->rating, 1)),
29
+                'title' => sprintf( __( '%s rating', 'site-reviews' ), number_format_i18n( $this->rating, 1 ) ),
30 30
             ],
31
-        ]);
31
+        ] );
32 32
     }
33 33
 
34 34
     /**
@@ -36,26 +36,26 @@  discard block
 block discarded – undo
36 36
      * @param int $timesRepeated
37 37
      * @return string
38 38
      */
39
-    protected function getTemplate($templateName, $timesRepeated)
39
+    protected function getTemplate( $templateName, $timesRepeated )
40 40
     {
41
-        $template = glsr(Template::class)->build('templates/rating/'.$templateName, [
41
+        $template = glsr( Template::class )->build( 'templates/rating/'.$templateName, [
42 42
             'context' => [
43 43
                 'prefix' => $this->prefix,
44 44
             ],
45
-        ]);
46
-        return str_repeat($template, $timesRepeated);
45
+        ] );
46
+        return str_repeat( $template, $timesRepeated );
47 47
     }
48 48
 
49 49
     /**
50 50
      * @return array
51 51
      */
52
-    protected function setProperties(array $args)
52
+    protected function setProperties( array $args )
53 53
     {
54
-        $args = wp_parse_args($args, [
54
+        $args = wp_parse_args( $args, [
55 55
             'prefix' => glsr()->isAdmin() ? '' : 'glsr-',
56 56
             'rating' => 0,
57
-        ]);
57
+        ] );
58 58
         $this->prefix = $args['prefix'];
59
-        $this->rating = (float) str_replace(',', '.', $args['rating']);
59
+        $this->rating = (float)str_replace( ',', '.', $args['rating'] );
60 60
     }
61 61
 }
Please login to merge, or discard this patch.
plugin/Controllers/NoticeController.php 2 patches
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -8,124 +8,124 @@
 block discarded – undo
8 8
 
9 9
 class NoticeController extends Controller
10 10
 {
11
-    const USER_META_KEY = '_glsr_notices';
11
+	const USER_META_KEY = '_glsr_notices';
12 12
 
13
-    /**
14
-     * @var array
15
-     */
16
-    protected $dismissValuesMap;
13
+	/**
14
+	 * @var array
15
+	 */
16
+	protected $dismissValuesMap;
17 17
 
18
-    public function __construct()
19
-    {
20
-        $this->dismissValuesMap = [
21
-            'rebusify' => glsr()->version('major'),
22
-            'welcome' => glsr()->version('minor'),
23
-        ];
24
-    }
18
+	public function __construct()
19
+	{
20
+		$this->dismissValuesMap = [
21
+			'rebusify' => glsr()->version('major'),
22
+			'welcome' => glsr()->version('minor'),
23
+		];
24
+	}
25 25
 
26
-    /**
27
-     * @return void
28
-     * @action admin_notices
29
-     */
30
-    public function filterAdminNotices()
31
-    {
32
-        $screen = glsr_current_screen();
33
-        $this->renderWelcomeNotice($screen->post_type);
34
-        $this->renderRebusifyNotice($screen->post_type);
35
-        $this->renderAddonsNotice($screen->id);
36
-    }
26
+	/**
27
+	 * @return void
28
+	 * @action admin_notices
29
+	 */
30
+	public function filterAdminNotices()
31
+	{
32
+		$screen = glsr_current_screen();
33
+		$this->renderWelcomeNotice($screen->post_type);
34
+		$this->renderRebusifyNotice($screen->post_type);
35
+		$this->renderAddonsNotice($screen->id);
36
+	}
37 37
 
38
-    /**
39
-     * @return void
40
-     */
41
-    public function routerDismissNotice(array $request)
42
-    {
43
-        if ($key = Arr::get($request, 'notice')) {
44
-            $this->dismissNotice($key);
45
-        }
46
-    }
38
+	/**
39
+	 * @return void
40
+	 */
41
+	public function routerDismissNotice(array $request)
42
+	{
43
+		if ($key = Arr::get($request, 'notice')) {
44
+			$this->dismissNotice($key);
45
+		}
46
+	}
47 47
 
48
-    /**
49
-     * @param string $key
50
-     * @return void
51
-     */
52
-    protected function dismissNotice($key)
53
-    {
54
-        $this->setUserMeta($key, $this->getVersionFor($key));
55
-    }
48
+	/**
49
+	 * @param string $key
50
+	 * @return void
51
+	 */
52
+	protected function dismissNotice($key)
53
+	{
54
+		$this->setUserMeta($key, $this->getVersionFor($key));
55
+	}
56 56
 
57
-    /**
58
-     * @param string $key
59
-     * @param mixed $fallback
60
-     * @return mixed
61
-     */
62
-    protected function getUserMeta($key, $fallback)
63
-    {
64
-        $meta = get_user_meta(get_current_user_id(), static::USER_META_KEY, true);
65
-        return Arr::get($meta, $key, $fallback);
66
-    }
57
+	/**
58
+	 * @param string $key
59
+	 * @param mixed $fallback
60
+	 * @return mixed
61
+	 */
62
+	protected function getUserMeta($key, $fallback)
63
+	{
64
+		$meta = get_user_meta(get_current_user_id(), static::USER_META_KEY, true);
65
+		return Arr::get($meta, $key, $fallback);
66
+	}
67 67
 
68
-    /**
69
-     * @param string $noticeKey
70
-     * @return string
71
-     */
72
-    protected function getVersionFor($noticeKey)
73
-    {
74
-        return Arr::get($this->dismissValuesMap, $noticeKey, glsr()->version('major'));
75
-    }
68
+	/**
69
+	 * @param string $noticeKey
70
+	 * @return string
71
+	 */
72
+	protected function getVersionFor($noticeKey)
73
+	{
74
+		return Arr::get($this->dismissValuesMap, $noticeKey, glsr()->version('major'));
75
+	}
76 76
 
77
-    /**
78
-     * @param string $screenId
79
-     * @return void
80
-     */
81
-    protected function renderAddonsNotice($screenId)
82
-    {
83
-        if (Application::POST_TYPE.'_page_addons' == $screenId) {
84
-            glsr()->render('partials/notices/addons');
85
-        }
86
-    }
77
+	/**
78
+	 * @param string $screenId
79
+	 * @return void
80
+	 */
81
+	protected function renderAddonsNotice($screenId)
82
+	{
83
+		if (Application::POST_TYPE.'_page_addons' == $screenId) {
84
+			glsr()->render('partials/notices/addons');
85
+		}
86
+	}
87 87
 
88
-    /**
89
-     * @param string $screenPostType
90
-     * @return void
91
-     */
92
-    protected function renderRebusifyNotice($screenPostType)
93
-    {
94
-        if (Application::POST_TYPE == $screenPostType
95
-            && version_compare($this->getVersionFor('rebusify'), $this->getUserMeta('rebusify', 0), '>')
96
-            && !glsr(OptionManager::class)->getBool('settings.general.rebusify')) {
97
-            glsr()->render('partials/notices/rebusify');
98
-        }
99
-    }
88
+	/**
89
+	 * @param string $screenPostType
90
+	 * @return void
91
+	 */
92
+	protected function renderRebusifyNotice($screenPostType)
93
+	{
94
+		if (Application::POST_TYPE == $screenPostType
95
+			&& version_compare($this->getVersionFor('rebusify'), $this->getUserMeta('rebusify', 0), '>')
96
+			&& !glsr(OptionManager::class)->getBool('settings.general.rebusify')) {
97
+			glsr()->render('partials/notices/rebusify');
98
+		}
99
+	}
100 100
 
101
-    /**
102
-     * @param string $screenPostType
103
-     * @return void
104
-     */
105
-    protected function renderWelcomeNotice($screenPostType)
106
-    {
107
-        if (Application::POST_TYPE == $screenPostType
108
-            && version_compare($this->getVersionFor('welcome'), $this->getUserMeta('welcome', 0), '>')) {
109
-            $welcomeText = '0.0.0' == glsr(OptionManager::class)->get('version_upgraded_from')
110
-                ? __('Thanks for installing Site Reviews %s, we hope you love it!', 'site-reviews')
111
-                : __('Thanks for updating to Site Reviews %s, we hope you love the changes!', 'site-reviews');
112
-            glsr()->render('partials/notices/welcome', [
113
-                'text' => sprintf($welcomeText, glsr()->version),
114
-            ]);
115
-        }
116
-    }
101
+	/**
102
+	 * @param string $screenPostType
103
+	 * @return void
104
+	 */
105
+	protected function renderWelcomeNotice($screenPostType)
106
+	{
107
+		if (Application::POST_TYPE == $screenPostType
108
+			&& version_compare($this->getVersionFor('welcome'), $this->getUserMeta('welcome', 0), '>')) {
109
+			$welcomeText = '0.0.0' == glsr(OptionManager::class)->get('version_upgraded_from')
110
+				? __('Thanks for installing Site Reviews %s, we hope you love it!', 'site-reviews')
111
+				: __('Thanks for updating to Site Reviews %s, we hope you love the changes!', 'site-reviews');
112
+			glsr()->render('partials/notices/welcome', [
113
+				'text' => sprintf($welcomeText, glsr()->version),
114
+			]);
115
+		}
116
+	}
117 117
 
118
-    /**
119
-     * @param string $key
120
-     * @param mixed $fallback
121
-     * @return mixed
122
-     */
123
-    protected function setUserMeta($key, $value)
124
-    {
125
-        $userId = get_current_user_id();
126
-        $meta = (array) get_user_meta($userId, static::USER_META_KEY, true);
127
-        $meta = array_filter(wp_parse_args($meta, []));
128
-        $meta[$key] = $value;
129
-        update_user_meta($userId, static::USER_META_KEY, $meta);
130
-    }
118
+	/**
119
+	 * @param string $key
120
+	 * @param mixed $fallback
121
+	 * @return mixed
122
+	 */
123
+	protected function setUserMeta($key, $value)
124
+	{
125
+		$userId = get_current_user_id();
126
+		$meta = (array) get_user_meta($userId, static::USER_META_KEY, true);
127
+		$meta = array_filter(wp_parse_args($meta, []));
128
+		$meta[$key] = $value;
129
+		update_user_meta($userId, static::USER_META_KEY, $meta);
130
+	}
131 131
 }
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
     public function __construct()
19 19
     {
20 20
         $this->dismissValuesMap = [
21
-            'rebusify' => glsr()->version('major'),
22
-            'welcome' => glsr()->version('minor'),
21
+            'rebusify' => glsr()->version( 'major' ),
22
+            'welcome' => glsr()->version( 'minor' ),
23 23
         ];
24 24
     }
25 25
 
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
     public function filterAdminNotices()
31 31
     {
32 32
         $screen = glsr_current_screen();
33
-        $this->renderWelcomeNotice($screen->post_type);
34
-        $this->renderRebusifyNotice($screen->post_type);
35
-        $this->renderAddonsNotice($screen->id);
33
+        $this->renderWelcomeNotice( $screen->post_type );
34
+        $this->renderRebusifyNotice( $screen->post_type );
35
+        $this->renderAddonsNotice( $screen->id );
36 36
     }
37 37
 
38 38
     /**
39 39
      * @return void
40 40
      */
41
-    public function routerDismissNotice(array $request)
41
+    public function routerDismissNotice( array $request )
42 42
     {
43
-        if ($key = Arr::get($request, 'notice')) {
44
-            $this->dismissNotice($key);
43
+        if( $key = Arr::get( $request, 'notice' ) ) {
44
+            $this->dismissNotice( $key );
45 45
         }
46 46
     }
47 47
 
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
      * @param string $key
50 50
      * @return void
51 51
      */
52
-    protected function dismissNotice($key)
52
+    protected function dismissNotice( $key )
53 53
     {
54
-        $this->setUserMeta($key, $this->getVersionFor($key));
54
+        $this->setUserMeta( $key, $this->getVersionFor( $key ) );
55 55
     }
56 56
 
57 57
     /**
@@ -59,29 +59,29 @@  discard block
 block discarded – undo
59 59
      * @param mixed $fallback
60 60
      * @return mixed
61 61
      */
62
-    protected function getUserMeta($key, $fallback)
62
+    protected function getUserMeta( $key, $fallback )
63 63
     {
64
-        $meta = get_user_meta(get_current_user_id(), static::USER_META_KEY, true);
65
-        return Arr::get($meta, $key, $fallback);
64
+        $meta = get_user_meta( get_current_user_id(), static::USER_META_KEY, true );
65
+        return Arr::get( $meta, $key, $fallback );
66 66
     }
67 67
 
68 68
     /**
69 69
      * @param string $noticeKey
70 70
      * @return string
71 71
      */
72
-    protected function getVersionFor($noticeKey)
72
+    protected function getVersionFor( $noticeKey )
73 73
     {
74
-        return Arr::get($this->dismissValuesMap, $noticeKey, glsr()->version('major'));
74
+        return Arr::get( $this->dismissValuesMap, $noticeKey, glsr()->version( 'major' ) );
75 75
     }
76 76
 
77 77
     /**
78 78
      * @param string $screenId
79 79
      * @return void
80 80
      */
81
-    protected function renderAddonsNotice($screenId)
81
+    protected function renderAddonsNotice( $screenId )
82 82
     {
83
-        if (Application::POST_TYPE.'_page_addons' == $screenId) {
84
-            glsr()->render('partials/notices/addons');
83
+        if( Application::POST_TYPE.'_page_addons' == $screenId ) {
84
+            glsr()->render( 'partials/notices/addons' );
85 85
         }
86 86
     }
87 87
 
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
      * @param string $screenPostType
90 90
      * @return void
91 91
      */
92
-    protected function renderRebusifyNotice($screenPostType)
92
+    protected function renderRebusifyNotice( $screenPostType )
93 93
     {
94
-        if (Application::POST_TYPE == $screenPostType
95
-            && version_compare($this->getVersionFor('rebusify'), $this->getUserMeta('rebusify', 0), '>')
96
-            && !glsr(OptionManager::class)->getBool('settings.general.rebusify')) {
97
-            glsr()->render('partials/notices/rebusify');
94
+        if( Application::POST_TYPE == $screenPostType
95
+            && version_compare( $this->getVersionFor( 'rebusify' ), $this->getUserMeta( 'rebusify', 0 ), '>' )
96
+            && !glsr( OptionManager::class )->getBool( 'settings.general.rebusify' ) ) {
97
+            glsr()->render( 'partials/notices/rebusify' );
98 98
         }
99 99
     }
100 100
 
@@ -102,16 +102,16 @@  discard block
 block discarded – undo
102 102
      * @param string $screenPostType
103 103
      * @return void
104 104
      */
105
-    protected function renderWelcomeNotice($screenPostType)
105
+    protected function renderWelcomeNotice( $screenPostType )
106 106
     {
107
-        if (Application::POST_TYPE == $screenPostType
108
-            && version_compare($this->getVersionFor('welcome'), $this->getUserMeta('welcome', 0), '>')) {
109
-            $welcomeText = '0.0.0' == glsr(OptionManager::class)->get('version_upgraded_from')
110
-                ? __('Thanks for installing Site Reviews %s, we hope you love it!', 'site-reviews')
111
-                : __('Thanks for updating to Site Reviews %s, we hope you love the changes!', 'site-reviews');
112
-            glsr()->render('partials/notices/welcome', [
113
-                'text' => sprintf($welcomeText, glsr()->version),
114
-            ]);
107
+        if( Application::POST_TYPE == $screenPostType
108
+            && version_compare( $this->getVersionFor( 'welcome' ), $this->getUserMeta( 'welcome', 0 ), '>' ) ) {
109
+            $welcomeText = '0.0.0' == glsr( OptionManager::class )->get( 'version_upgraded_from' )
110
+                ? __( 'Thanks for installing Site Reviews %s, we hope you love it!', 'site-reviews' )
111
+                : __( 'Thanks for updating to Site Reviews %s, we hope you love the changes!', 'site-reviews' );
112
+            glsr()->render( 'partials/notices/welcome', [
113
+                'text' => sprintf( $welcomeText, glsr()->version ),
114
+            ] );
115 115
         }
116 116
     }
117 117
 
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
      * @param mixed $fallback
121 121
      * @return mixed
122 122
      */
123
-    protected function setUserMeta($key, $value)
123
+    protected function setUserMeta( $key, $value )
124 124
     {
125 125
         $userId = get_current_user_id();
126
-        $meta = (array) get_user_meta($userId, static::USER_META_KEY, true);
127
-        $meta = array_filter(wp_parse_args($meta, []));
126
+        $meta = (array)get_user_meta( $userId, static::USER_META_KEY, true );
127
+        $meta = array_filter( wp_parse_args( $meta, [] ) );
128 128
         $meta[$key] = $value;
129
-        update_user_meta($userId, static::USER_META_KEY, $meta);
129
+        update_user_meta( $userId, static::USER_META_KEY, $meta );
130 130
     }
131 131
 }
Please login to merge, or discard this patch.
plugin/Blocks/SiteReviewsFormBlock.php 2 patches
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -7,115 +7,115 @@
 block discarded – undo
7 7
 
8 8
 class SiteReviewsFormBlock extends BlockGenerator
9 9
 {
10
-    /**
11
-     * @return array
12
-     */
13
-    public function attributes()
14
-    {
15
-        return [
16
-            'assign_to' => [
17
-                'default' => '',
18
-                'type' => 'string',
19
-            ],
20
-            'category' => [
21
-                'default' => '',
22
-                'type' => 'string',
23
-            ],
24
-            'className' => [
25
-                'default' => '',
26
-                'type' => 'string',
27
-            ],
28
-            'hide' => [
29
-                'default' => '',
30
-                'type' => 'string',
31
-            ],
32
-            'id' => [
33
-                'default' => '',
34
-                'type' => 'string',
35
-            ],
36
-        ];
37
-    }
10
+	/**
11
+	 * @return array
12
+	 */
13
+	public function attributes()
14
+	{
15
+		return [
16
+			'assign_to' => [
17
+				'default' => '',
18
+				'type' => 'string',
19
+			],
20
+			'category' => [
21
+				'default' => '',
22
+				'type' => 'string',
23
+			],
24
+			'className' => [
25
+				'default' => '',
26
+				'type' => 'string',
27
+			],
28
+			'hide' => [
29
+				'default' => '',
30
+				'type' => 'string',
31
+			],
32
+			'id' => [
33
+				'default' => '',
34
+				'type' => 'string',
35
+			],
36
+		];
37
+	}
38 38
 
39
-    /**
40
-     * @return string
41
-     */
42
-    public function render(array $attributes)
43
-    {
44
-        $attributes['class'] = $attributes['className'];
45
-        $shortcode = glsr(Shortcode::class);
46
-        if ('edit' == filter_input(INPUT_GET, 'context')) {
47
-            $this->filterFormFields();
48
-            $this->filterRatingField();
49
-            $this->filterShortcodeClass();
50
-            $this->filterSubmitButton();
51
-            if (!$this->hasVisibleFields($shortcode, $attributes)) {
52
-                $this->filterInterpolation();
53
-            }
54
-        }
55
-        return $shortcode->buildShortcode($attributes);
56
-    }
39
+	/**
40
+	 * @return string
41
+	 */
42
+	public function render(array $attributes)
43
+	{
44
+		$attributes['class'] = $attributes['className'];
45
+		$shortcode = glsr(Shortcode::class);
46
+		if ('edit' == filter_input(INPUT_GET, 'context')) {
47
+			$this->filterFormFields();
48
+			$this->filterRatingField();
49
+			$this->filterShortcodeClass();
50
+			$this->filterSubmitButton();
51
+			if (!$this->hasVisibleFields($shortcode, $attributes)) {
52
+				$this->filterInterpolation();
53
+			}
54
+		}
55
+		return $shortcode->buildShortcode($attributes);
56
+	}
57 57
 
58
-    /**
59
-     * @return void
60
-     */
61
-    protected function filterFormFields()
62
-    {
63
-        add_filter('site-reviews/config/forms/submission-form', function (array $config) {
64
-            array_walk($config, function (&$field) {
65
-                $field['disabled'] = true;
66
-                $field['tabindex'] = '-1';
67
-            });
68
-            return $config;
69
-        });
70
-    }
58
+	/**
59
+	 * @return void
60
+	 */
61
+	protected function filterFormFields()
62
+	{
63
+		add_filter('site-reviews/config/forms/submission-form', function (array $config) {
64
+			array_walk($config, function (&$field) {
65
+				$field['disabled'] = true;
66
+				$field['tabindex'] = '-1';
67
+			});
68
+			return $config;
69
+		});
70
+	}
71 71
 
72
-    /**
73
-     * @return void
74
-     */
75
-    protected function filterInterpolation()
76
-    {
77
-        add_filter('site-reviews/interpolate/reviews-form', function ($context) {
78
-            $context['class'] = 'glsr-default glsr-block-disabled';
79
-            $context['fields'] = __('You have hidden all of the fields for this block.', 'site-reviews');
80
-            $context['response'] = '';
81
-            $context['submit_button'] = '';
82
-            return $context;
83
-        });
84
-    }
72
+	/**
73
+	 * @return void
74
+	 */
75
+	protected function filterInterpolation()
76
+	{
77
+		add_filter('site-reviews/interpolate/reviews-form', function ($context) {
78
+			$context['class'] = 'glsr-default glsr-block-disabled';
79
+			$context['fields'] = __('You have hidden all of the fields for this block.', 'site-reviews');
80
+			$context['response'] = '';
81
+			$context['submit_button'] = '';
82
+			return $context;
83
+		});
84
+	}
85 85
 
86
-    /**
87
-     * @return void
88
-     */
89
-    protected function filterRatingField()
90
-    {
91
-        add_filter('site-reviews/rendered/field', function ($html, $type, $args) {
92
-            if ('rating' == $args['path']) {
93
-                $stars = '<span class="glsr-stars">';
94
-                $stars.= str_repeat('<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', (int) glsr()->constant('MAX_RATING', Rating::class));
95
-                $stars.= '</span>';
96
-                $html = preg_replace('/(.*)(<select.*)(<\/select>)(.*)/', '$1'.$stars.'$4', $html);
97
-            }
98
-            return $html;
99
-        }, 10, 3);
100
-    }
86
+	/**
87
+	 * @return void
88
+	 */
89
+	protected function filterRatingField()
90
+	{
91
+		add_filter('site-reviews/rendered/field', function ($html, $type, $args) {
92
+			if ('rating' == $args['path']) {
93
+				$stars = '<span class="glsr-stars">';
94
+				$stars.= str_repeat('<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', (int) glsr()->constant('MAX_RATING', Rating::class));
95
+				$stars.= '</span>';
96
+				$html = preg_replace('/(.*)(<select.*)(<\/select>)(.*)/', '$1'.$stars.'$4', $html);
97
+			}
98
+			return $html;
99
+		}, 10, 3);
100
+	}
101 101
 
102
-    /**
103
-     * @return void
104
-     */
105
-    protected function filterShortcodeClass()
106
-    {
107
-        add_filter('site-reviews/style', function () {
108
-            return 'default';
109
-        });
110
-    }
102
+	/**
103
+	 * @return void
104
+	 */
105
+	protected function filterShortcodeClass()
106
+	{
107
+		add_filter('site-reviews/style', function () {
108
+			return 'default';
109
+		});
110
+	}
111 111
 
112
-    /**
113
-     * @return void
114
-     */
115
-    protected function filterSubmitButton()
116
-    {
117
-        add_filter('site-reviews/rendered/template/form/submit-button', function ($template) {
118
-            return str_replace('type="submit"', 'tabindex="-1"', $template);
119
-        });
120
-    }
112
+	/**
113
+	 * @return void
114
+	 */
115
+	protected function filterSubmitButton()
116
+	{
117
+		add_filter('site-reviews/rendered/template/form/submit-button', function ($template) {
118
+			return str_replace('type="submit"', 'tabindex="-1"', $template);
119
+		});
120
+	}
121 121
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -39,20 +39,20 @@  discard block
 block discarded – undo
39 39
     /**
40 40
      * @return string
41 41
      */
42
-    public function render(array $attributes)
42
+    public function render( array $attributes )
43 43
     {
44 44
         $attributes['class'] = $attributes['className'];
45
-        $shortcode = glsr(Shortcode::class);
46
-        if ('edit' == filter_input(INPUT_GET, 'context')) {
45
+        $shortcode = glsr( Shortcode::class );
46
+        if( 'edit' == filter_input( INPUT_GET, 'context' ) ) {
47 47
             $this->filterFormFields();
48 48
             $this->filterRatingField();
49 49
             $this->filterShortcodeClass();
50 50
             $this->filterSubmitButton();
51
-            if (!$this->hasVisibleFields($shortcode, $attributes)) {
51
+            if( !$this->hasVisibleFields( $shortcode, $attributes ) ) {
52 52
                 $this->filterInterpolation();
53 53
             }
54 54
         }
55
-        return $shortcode->buildShortcode($attributes);
55
+        return $shortcode->buildShortcode( $attributes );
56 56
     }
57 57
 
58 58
     /**
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
      */
61 61
     protected function filterFormFields()
62 62
     {
63
-        add_filter('site-reviews/config/forms/submission-form', function (array $config) {
64
-            array_walk($config, function (&$field) {
63
+        add_filter( 'site-reviews/config/forms/submission-form', function( array $config ) {
64
+            array_walk( $config, function( &$field ) {
65 65
                 $field['disabled'] = true;
66 66
                 $field['tabindex'] = '-1';
67 67
             });
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
      */
75 75
     protected function filterInterpolation()
76 76
     {
77
-        add_filter('site-reviews/interpolate/reviews-form', function ($context) {
77
+        add_filter( 'site-reviews/interpolate/reviews-form', function( $context ) {
78 78
             $context['class'] = 'glsr-default glsr-block-disabled';
79
-            $context['fields'] = __('You have hidden all of the fields for this block.', 'site-reviews');
79
+            $context['fields'] = __( 'You have hidden all of the fields for this block.', 'site-reviews' );
80 80
             $context['response'] = '';
81 81
             $context['submit_button'] = '';
82 82
             return $context;
@@ -88,15 +88,15 @@  discard block
 block discarded – undo
88 88
      */
89 89
     protected function filterRatingField()
90 90
     {
91
-        add_filter('site-reviews/rendered/field', function ($html, $type, $args) {
92
-            if ('rating' == $args['path']) {
91
+        add_filter( 'site-reviews/rendered/field', function( $html, $type, $args ) {
92
+            if( 'rating' == $args['path'] ) {
93 93
                 $stars = '<span class="glsr-stars">';
94
-                $stars.= str_repeat('<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', (int) glsr()->constant('MAX_RATING', Rating::class));
95
-                $stars.= '</span>';
96
-                $html = preg_replace('/(.*)(<select.*)(<\/select>)(.*)/', '$1'.$stars.'$4', $html);
94
+                $stars .= str_repeat( '<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', (int)glsr()->constant( 'MAX_RATING', Rating::class ) );
95
+                $stars .= '</span>';
96
+                $html = preg_replace( '/(.*)(<select.*)(<\/select>)(.*)/', '$1'.$stars.'$4', $html );
97 97
             }
98 98
             return $html;
99
-        }, 10, 3);
99
+        }, 10, 3 );
100 100
     }
101 101
 
102 102
     /**
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      */
105 105
     protected function filterShortcodeClass()
106 106
     {
107
-        add_filter('site-reviews/style', function () {
107
+        add_filter( 'site-reviews/style', function() {
108 108
             return 'default';
109 109
         });
110 110
     }
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
      */
115 115
     protected function filterSubmitButton()
116 116
     {
117
-        add_filter('site-reviews/rendered/template/form/submit-button', function ($template) {
118
-            return str_replace('type="submit"', 'tabindex="-1"', $template);
117
+        add_filter( 'site-reviews/rendered/template/form/submit-button', function( $template ) {
118
+            return str_replace( 'type="submit"', 'tabindex="-1"', $template );
119 119
         });
120 120
     }
121 121
 }
Please login to merge, or discard this patch.