Passed
Push — master ( ccb079...7906b4 )
by Paul
04:39
created
plugin/Controllers/Controller.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,8 @@
 block discarded – undo
38 38
         }
39 39
         try {
40 40
             return glsr($handlerClass)->handle($command);
41
-        } catch (Exception $e) {
41
+        }
42
+        catch (Exception $e) {
42 43
             status_header(400);
43 44
             glsr(Notice::class)->addError(new WP_Error('site_reviews_error', $e->getMessage()));
44 45
             glsr_log()->error($e->getMessage());
Please login to merge, or discard this patch.
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -10,64 +10,64 @@
 block discarded – undo
10 10
 
11 11
 abstract class Controller
12 12
 {
13
-    /**
14
-     * @return void
15
-     */
16
-    public function download($filename, $content)
17
-    {
18
-        if (!glsr()->can('edit_others_posts')) {
19
-            return;
20
-        }
21
-        nocache_headers();
22
-        header('Content-Type: text/plain');
23
-        header('Content-Disposition: attachment; filename="'.$filename.'"');
24
-        echo html_entity_decode($content);
25
-        exit;
26
-    }
13
+	/**
14
+	 * @return void
15
+	 */
16
+	public function download($filename, $content)
17
+	{
18
+		if (!glsr()->can('edit_others_posts')) {
19
+			return;
20
+		}
21
+		nocache_headers();
22
+		header('Content-Type: text/plain');
23
+		header('Content-Disposition: attachment; filename="'.$filename.'"');
24
+		echo html_entity_decode($content);
25
+		exit;
26
+	}
27 27
 
28
-    /**
29
-     * @param object $command
30
-     * @return mixed
31
-     * @throws InvalidArgumentException
32
-     */
33
-    public function execute($command)
34
-    {
35
-        $handlerClass = str_replace('Commands', 'Handlers', get_class($command));
36
-        if (!class_exists($handlerClass)) {
37
-            throw new InvalidArgumentException('Handler '.$handlerClass.' not found.');
38
-        }
39
-        try {
40
-            return glsr($handlerClass)->handle($command);
41
-        } catch (Exception $e) {
42
-            status_header(400);
43
-            glsr(Notice::class)->addError(new WP_Error('site_reviews_error', $e->getMessage()));
44
-            glsr_log()->error($e->getMessage());
45
-        }
46
-    }
28
+	/**
29
+	 * @param object $command
30
+	 * @return mixed
31
+	 * @throws InvalidArgumentException
32
+	 */
33
+	public function execute($command)
34
+	{
35
+		$handlerClass = str_replace('Commands', 'Handlers', get_class($command));
36
+		if (!class_exists($handlerClass)) {
37
+			throw new InvalidArgumentException('Handler '.$handlerClass.' not found.');
38
+		}
39
+		try {
40
+			return glsr($handlerClass)->handle($command);
41
+		} catch (Exception $e) {
42
+			status_header(400);
43
+			glsr(Notice::class)->addError(new WP_Error('site_reviews_error', $e->getMessage()));
44
+			glsr_log()->error($e->getMessage());
45
+		}
46
+	}
47 47
 
48
-    /**
49
-     * @return int
50
-     */
51
-    protected function getPostId()
52
-    {
53
-        return intval(filter_input(INPUT_GET, 'post'));
54
-    }
48
+	/**
49
+	 * @return int
50
+	 */
51
+	protected function getPostId()
52
+	{
53
+		return intval(filter_input(INPUT_GET, 'post'));
54
+	}
55 55
 
56
-    /**
57
-     * @return bool
58
-     */
59
-    protected function isReviewAdminPage()
60
-    {
61
-        return is_admin() 
62
-            && in_array(glsr()->post_type, [get_post_type(), filter_input(INPUT_GET, 'post_type')]);
63
-    }
56
+	/**
57
+	 * @return bool
58
+	 */
59
+	protected function isReviewAdminPage()
60
+	{
61
+		return is_admin() 
62
+			&& in_array(glsr()->post_type, [get_post_type(), filter_input(INPUT_GET, 'post_type')]);
63
+	}
64 64
 
65
-    /**
66
-     * @param int $postId
67
-     * @return bool
68
-     */
69
-    protected function isReviewPostId($postId)
70
-    {
71
-        return Application::POST_TYPE == get_post_field('post_type', $postId);
72
-    }
65
+	/**
66
+	 * @param int $postId
67
+	 * @return bool
68
+	 */
69
+	protected function isReviewPostId($postId)
70
+	{
71
+		return Application::POST_TYPE == get_post_field('post_type', $postId);
72
+	}
73 73
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@  discard block
 block discarded – undo
13 13
     /**
14 14
      * @return void
15 15
      */
16
-    public function download($filename, $content)
16
+    public function download( $filename, $content )
17 17
     {
18
-        if (!glsr()->can('edit_others_posts')) {
18
+        if( !glsr()->can( 'edit_others_posts' ) ) {
19 19
             return;
20 20
         }
21 21
         nocache_headers();
22
-        header('Content-Type: text/plain');
23
-        header('Content-Disposition: attachment; filename="'.$filename.'"');
24
-        echo html_entity_decode($content);
22
+        header( 'Content-Type: text/plain' );
23
+        header( 'Content-Disposition: attachment; filename="'.$filename.'"' );
24
+        echo html_entity_decode( $content );
25 25
         exit;
26 26
     }
27 27
 
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
      * @return mixed
31 31
      * @throws InvalidArgumentException
32 32
      */
33
-    public function execute($command)
33
+    public function execute( $command )
34 34
     {
35
-        $handlerClass = str_replace('Commands', 'Handlers', get_class($command));
36
-        if (!class_exists($handlerClass)) {
37
-            throw new InvalidArgumentException('Handler '.$handlerClass.' not found.');
35
+        $handlerClass = str_replace( 'Commands', 'Handlers', get_class( $command ) );
36
+        if( !class_exists( $handlerClass ) ) {
37
+            throw new InvalidArgumentException( 'Handler '.$handlerClass.' not found.' );
38 38
         }
39 39
         try {
40
-            return glsr($handlerClass)->handle($command);
41
-        } catch (Exception $e) {
42
-            status_header(400);
43
-            glsr(Notice::class)->addError(new WP_Error('site_reviews_error', $e->getMessage()));
44
-            glsr_log()->error($e->getMessage());
40
+            return glsr( $handlerClass )->handle( $command );
41
+        } catch( Exception $e ) {
42
+            status_header( 400 );
43
+            glsr( Notice::class )->addError( new WP_Error( 'site_reviews_error', $e->getMessage() ) );
44
+            glsr_log()->error( $e->getMessage() );
45 45
         }
46 46
     }
47 47
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      */
51 51
     protected function getPostId()
52 52
     {
53
-        return intval(filter_input(INPUT_GET, 'post'));
53
+        return intval( filter_input( INPUT_GET, 'post' ) );
54 54
     }
55 55
 
56 56
     /**
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
     protected function isReviewAdminPage()
60 60
     {
61 61
         return is_admin() 
62
-            && in_array(glsr()->post_type, [get_post_type(), filter_input(INPUT_GET, 'post_type')]);
62
+            && in_array( glsr()->post_type, [get_post_type(), filter_input( INPUT_GET, 'post_type' )] );
63 63
     }
64 64
 
65 65
     /**
66 66
      * @param int $postId
67 67
      * @return bool
68 68
      */
69
-    protected function isReviewPostId($postId)
69
+    protected function isReviewPostId( $postId )
70 70
     {
71
-        return Application::POST_TYPE == get_post_field('post_type', $postId);
71
+        return Application::POST_TYPE == get_post_field( 'post_type', $postId );
72 72
     }
73 73
 }
Please login to merge, or discard this patch.
plugin/Controllers/RestReviewController.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 {
15 15
     public function __construct()
16 16
     {
17
-        $this->meta = new WP_REST_Post_Meta_Fields(Application::POST_TYPE);
17
+        $this->meta = new WP_REST_Post_Meta_Fields( Application::POST_TYPE );
18 18
         $this->namespace = Application::ID.'/v1';
19 19
         $this->post_type = Application::POST_TYPE;
20 20
         $this->rest_base = 'reviews';
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
         //  ['callback' => [$this, 'createReview'], 'methods' => Server::CREATABLE],
30 30
         //  ['callback' => [$this, 'getReviews'], 'methods' => Server::READABLE],
31 31
         // ]);
32
-        register_rest_route($this->namespace, '/types', [
32
+        register_rest_route( $this->namespace, '/types', [
33 33
             ['callback' => [$this, 'getReviewTypes'], 'methods' => Server::READABLE],
34
-        ]);
34
+        ] );
35 35
     }
36 36
 
37 37
     /**
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     public function createReview()
41 41
     {
42 42
         $response = [];
43
-        return rest_ensure_response($response);
43
+        return rest_ensure_response( $response );
44 44
     }
45 45
 
46 46
     /**
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     public function getReviews()
50 50
     {
51 51
         $response = [];
52
-        return rest_ensure_response($response);
52
+        return rest_ensure_response( $response );
53 53
     }
54 54
 
55 55
     /**
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
     public function getReviewTypes()
59 59
     {
60 60
         $response = [];
61
-        foreach (glsr()->reviewTypes as $slug => $name) {
61
+        foreach( glsr()->reviewTypes as $slug => $name ) {
62 62
             $response[] = [
63 63
                 'name' => $name,
64 64
                 'slug' => $slug,
65 65
             ];
66 66
         }
67
-        return rest_ensure_response($response);
67
+        return rest_ensure_response( $response );
68 68
     }
69 69
 }
Please login to merge, or discard this patch.
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -12,58 +12,58 @@
 block discarded – undo
12 12
 
13 13
 class RestReviewController extends RestController
14 14
 {
15
-    public function __construct()
16
-    {
17
-        $this->meta = new WP_REST_Post_Meta_Fields(Application::POST_TYPE);
18
-        $this->namespace = Application::ID.'/v1';
19
-        $this->post_type = Application::POST_TYPE;
20
-        $this->rest_base = 'reviews';
21
-    }
15
+	public function __construct()
16
+	{
17
+		$this->meta = new WP_REST_Post_Meta_Fields(Application::POST_TYPE);
18
+		$this->namespace = Application::ID.'/v1';
19
+		$this->post_type = Application::POST_TYPE;
20
+		$this->rest_base = 'reviews';
21
+	}
22 22
 
23
-    /**
24
-     * @return void
25
-     */
26
-    public function register_routes()
27
-    {
28
-        // register_rest_route($this->namespace, '/'.$this->rest_base, [
29
-        //  ['callback' => [$this, 'createReview'], 'methods' => Server::CREATABLE],
30
-        //  ['callback' => [$this, 'getReviews'], 'methods' => Server::READABLE],
31
-        // ]);
32
-        register_rest_route($this->namespace, '/types', [
33
-            ['callback' => [$this, 'getReviewTypes'], 'methods' => Server::READABLE],
34
-        ]);
35
-    }
23
+	/**
24
+	 * @return void
25
+	 */
26
+	public function register_routes()
27
+	{
28
+		// register_rest_route($this->namespace, '/'.$this->rest_base, [
29
+		//  ['callback' => [$this, 'createReview'], 'methods' => Server::CREATABLE],
30
+		//  ['callback' => [$this, 'getReviews'], 'methods' => Server::READABLE],
31
+		// ]);
32
+		register_rest_route($this->namespace, '/types', [
33
+			['callback' => [$this, 'getReviewTypes'], 'methods' => Server::READABLE],
34
+		]);
35
+	}
36 36
 
37
-    /**
38
-     * @return WP_Error|Response|mixed
39
-     */
40
-    public function createReview()
41
-    {
42
-        $response = [];
43
-        return rest_ensure_response($response);
44
-    }
37
+	/**
38
+	 * @return WP_Error|Response|mixed
39
+	 */
40
+	public function createReview()
41
+	{
42
+		$response = [];
43
+		return rest_ensure_response($response);
44
+	}
45 45
 
46
-    /**
47
-     * @return WP_Error|Response|mixed
48
-     */
49
-    public function getReviews()
50
-    {
51
-        $response = [];
52
-        return rest_ensure_response($response);
53
-    }
46
+	/**
47
+	 * @return WP_Error|Response|mixed
48
+	 */
49
+	public function getReviews()
50
+	{
51
+		$response = [];
52
+		return rest_ensure_response($response);
53
+	}
54 54
 
55
-    /**
56
-     * @return WP_Error|Response|mixed
57
-     */
58
-    public function getReviewTypes()
59
-    {
60
-        $response = [];
61
-        foreach (glsr()->reviewTypes as $slug => $name) {
62
-            $response[] = [
63
-                'name' => $name,
64
-                'slug' => $slug,
65
-            ];
66
-        }
67
-        return rest_ensure_response($response);
68
-    }
55
+	/**
56
+	 * @return WP_Error|Response|mixed
57
+	 */
58
+	public function getReviewTypes()
59
+	{
60
+		$response = [];
61
+		foreach (glsr()->reviewTypes as $slug => $name) {
62
+			$response[] = [
63
+				'name' => $name,
64
+				'slug' => $slug,
65
+			];
66
+		}
67
+		return rest_ensure_response($response);
68
+	}
69 69
 }
Please login to merge, or discard this patch.
plugin/Commands/TogglePinned.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@
 block discarded – undo
4 4
 
5 5
 class TogglePinned
6 6
 {
7
-    public $id;
8
-    public $pinned;
7
+	public $id;
8
+	public $pinned;
9 9
 
10
-    public function __construct($input)
11
-    {
12
-        $this->id = $input['id'];
13
-        $this->pinned = isset($input['pinned'])
14
-            ? wp_validate_boolean($input['pinned'])
15
-            : null;
16
-    }
10
+	public function __construct($input)
11
+	{
12
+		$this->id = $input['id'];
13
+		$this->pinned = isset($input['pinned'])
14
+			? wp_validate_boolean($input['pinned'])
15
+			: null;
16
+	}
17 17
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@
 block discarded – undo
7 7
     public $id;
8 8
     public $pinned;
9 9
 
10
-    public function __construct($input)
10
+    public function __construct( $input )
11 11
     {
12 12
         $this->id = $input['id'];
13 13
         $this->pinned = isset($input['pinned'])
14
-            ? wp_validate_boolean($input['pinned'])
14
+            ? wp_validate_boolean( $input['pinned'] )
15 15
             : null;
16 16
     }
17 17
 }
Please login to merge, or discard this patch.
plugin/Commands/ChangeStatus.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@
 block discarded – undo
4 4
 
5 5
 class ChangeStatus
6 6
 {
7
-    public $id;
8
-    public $status;
7
+	public $id;
8
+	public $status;
9 9
 
10
-    public function __construct($input)
11
-    {
12
-        $this->id = $input['post_id'];
13
-        $this->status = 'approve' == $input['status']
14
-            ? 'publish'
15
-            : 'pending';
16
-    }
10
+	public function __construct($input)
11
+	{
12
+		$this->id = $input['post_id'];
13
+		$this->status = 'approve' == $input['status']
14
+			? 'publish'
15
+			: 'pending';
16
+	}
17 17
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
     public $id;
8 8
     public $status;
9 9
 
10
-    public function __construct($input)
10
+    public function __construct( $input )
11 11
     {
12 12
         $this->id = $input['post_id'];
13 13
         $this->status = 'approve' == $input['status']
Please login to merge, or discard this patch.
plugin/Commands/RegisterTinymcePopups.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@
 block discarded – undo
4 4
 
5 5
 class RegisterTinymcePopups
6 6
 {
7
-    public $popups;
7
+	public $popups;
8 8
 
9
-    public function __construct($input)
10
-    {
11
-        $this->popups = $input;
12
-    }
9
+	public function __construct($input)
10
+	{
11
+		$this->popups = $input;
12
+	}
13 13
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 {
7 7
     public $popups;
8 8
 
9
-    public function __construct($input)
9
+    public function __construct( $input )
10 10
     {
11 11
         $this->popups = $input;
12 12
     }
Please login to merge, or discard this patch.
plugin/Commands/RegisterTaxonomy.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@
 block discarded – undo
4 4
 
5 5
 class RegisterTaxonomy
6 6
 {
7
-    public $args;
7
+	public $args;
8 8
 
9
-    public function __construct($input)
10
-    {
11
-        $this->args = $input;
12
-    }
9
+	public function __construct($input)
10
+	{
11
+		$this->args = $input;
12
+	}
13 13
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 {
7 7
     public $args;
8 8
 
9
-    public function __construct($input)
9
+    public function __construct( $input )
10 10
     {
11 11
         $this->args = $input;
12 12
     }
Please login to merge, or discard this patch.
plugin/Commands/EnqueueAdminAssets.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@
 block discarded – undo
4 4
 
5 5
 class EnqueueAdminAssets
6 6
 {
7
-    public $pointers;
7
+	public $pointers;
8 8
 
9
-    public function __construct(array $input)
10
-    {
11
-        $this->pointers = $input['pointers'];
12
-    }
9
+	public function __construct(array $input)
10
+	{
11
+		$this->pointers = $input['pointers'];
12
+	}
13 13
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 {
7 7
     public $pointers;
8 8
 
9
-    public function __construct(array $input)
9
+    public function __construct( array $input )
10 10
     {
11 11
         $this->pointers = $input['pointers'];
12 12
     }
Please login to merge, or discard this patch.
plugin/Commands/RegisterShortcodes.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@
 block discarded – undo
4 4
 
5 5
 class RegisterShortcodes
6 6
 {
7
-    public $shortcodes;
7
+	public $shortcodes;
8 8
 
9
-    public function __construct($input)
10
-    {
11
-        $this->shortcodes = $input;
12
-    }
9
+	public function __construct($input)
10
+	{
11
+		$this->shortcodes = $input;
12
+	}
13 13
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 {
7 7
     public $shortcodes;
8 8
 
9
-    public function __construct($input)
9
+    public function __construct( $input )
10 10
     {
11 11
         $this->shortcodes = $input;
12 12
     }
Please login to merge, or discard this patch.
plugin/Database.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,8 @@
 block discarded – undo
116 116
         ];
117 117
         if (is_numeric($searchTerm)) {
118 118
             $args['post__in'] = [$searchTerm];
119
-        } else {
119
+        }
120
+        else {
120 121
             $args['orderby'] = 'relevance';
121 122
             $args['posts_per_page'] = 10;
122 123
             $args['s'] = $searchTerm;
Please login to merge, or discard this patch.
Indentation   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -12,168 +12,168 @@
 block discarded – undo
12 12
 
13 13
 class Database
14 14
 {
15
-    /**
16
-     * @param int $postId
17
-     * @param string $key
18
-     * @param bool $single
19
-     * @return mixed
20
-     */
21
-    public function get($postId, $key, $single = true)
22
-    {
23
-        $key = Str::prefix('_', $key);
24
-        return get_post_meta(intval($postId), $key, $single);
25
-    }
15
+	/**
16
+	 * @param int $postId
17
+	 * @param string $key
18
+	 * @param bool $single
19
+	 * @return mixed
20
+	 */
21
+	public function get($postId, $key, $single = true)
22
+	{
23
+		$key = Str::prefix('_', $key);
24
+		return get_post_meta(intval($postId), $key, $single);
25
+	}
26 26
 
27
-    /**
28
-     * @param int $postId
29
-     * @param string $assignedTo
30
-     * @return void|WP_Post
31
-     */
32
-    public function getAssignedToPost($postId, $assignedTo = '')
33
-    {
34
-        if (empty($assignedTo)) {
35
-            $assignedTo = $this->get($postId, 'assigned_to');
36
-        }
37
-        if (empty($assignedTo)) {
38
-            return;
39
-        }
40
-        $assignedPost = get_post($assignedTo);
41
-        if ($assignedPost instanceof WP_Post && $assignedPost->ID != $postId) {
42
-            return $assignedPost;
43
-        }
44
-    }
27
+	/**
28
+	 * @param int $postId
29
+	 * @param string $assignedTo
30
+	 * @return void|WP_Post
31
+	 */
32
+	public function getAssignedToPost($postId, $assignedTo = '')
33
+	{
34
+		if (empty($assignedTo)) {
35
+			$assignedTo = $this->get($postId, 'assigned_to');
36
+		}
37
+		if (empty($assignedTo)) {
38
+			return;
39
+		}
40
+		$assignedPost = get_post($assignedTo);
41
+		if ($assignedPost instanceof WP_Post && $assignedPost->ID != $postId) {
42
+			return $assignedPost;
43
+		}
44
+	}
45 45
 
46
-    /**
47
-     * @param string $metaKey
48
-     * @param string $metaValue
49
-     * @return array|int
50
-     */
51
-    public function getReviewCount($metaKey = '', $metaValue = '')
52
-    {
53
-        if (!$metaKey) {
54
-            return (array) wp_count_posts(Application::POST_TYPE);
55
-        }
56
-        $counts = glsr(Cache::class)->getReviewCountsFor($metaKey);
57
-        if (!$metaValue) {
58
-            return $counts;
59
-        }
60
-        return Arr::get($counts, $metaValue, 0);
61
-    }
46
+	/**
47
+	 * @param string $metaKey
48
+	 * @param string $metaValue
49
+	 * @return array|int
50
+	 */
51
+	public function getReviewCount($metaKey = '', $metaValue = '')
52
+	{
53
+		if (!$metaKey) {
54
+			return (array) wp_count_posts(Application::POST_TYPE);
55
+		}
56
+		$counts = glsr(Cache::class)->getReviewCountsFor($metaKey);
57
+		if (!$metaValue) {
58
+			return $counts;
59
+		}
60
+		return Arr::get($counts, $metaValue, 0);
61
+	}
62 62
 
63
-    /**
64
-     * @param string $metaReviewType
65
-     * @return array
66
-     */
67
-    public function getReviewIdsByType($metaReviewType)
68
-    {
69
-        return glsr(SqlQueries::class)->getReviewIdsByType($metaReviewType);
70
-    }
63
+	/**
64
+	 * @param string $metaReviewType
65
+	 * @return array
66
+	 */
67
+	public function getReviewIdsByType($metaReviewType)
68
+	{
69
+		return glsr(SqlQueries::class)->getReviewIdsByType($metaReviewType);
70
+	}
71 71
 
72
-    /**
73
-     * @param string $key
74
-     * @param string $status
75
-     * @return array
76
-     */
77
-    public function getReviewsMeta($key, $status = 'publish')
78
-    {
79
-        return glsr(SqlQueries::class)->getReviewsMeta($key, $status);
80
-    }
72
+	/**
73
+	 * @param string $key
74
+	 * @param string $status
75
+	 * @return array
76
+	 */
77
+	public function getReviewsMeta($key, $status = 'publish')
78
+	{
79
+		return glsr(SqlQueries::class)->getReviewsMeta($key, $status);
80
+	}
81 81
 
82
-    /**
83
-     * @param string $field
84
-     * @return array
85
-     */
86
-    public function getTermIds(array $values, $field)
87
-    {
88
-        $termIds = [];
89
-        foreach ($values as $value) {
90
-            $term = get_term_by($field, $value, Application::TAXONOMY);
91
-            if (!isset($term->term_id)) {
92
-                continue;
93
-            }
94
-            $termIds[] = $term->term_id;
95
-        }
96
-        return $termIds;
97
-    }
82
+	/**
83
+	 * @param string $field
84
+	 * @return array
85
+	 */
86
+	public function getTermIds(array $values, $field)
87
+	{
88
+		$termIds = [];
89
+		foreach ($values as $value) {
90
+			$term = get_term_by($field, $value, Application::TAXONOMY);
91
+			if (!isset($term->term_id)) {
92
+				continue;
93
+			}
94
+			$termIds[] = $term->term_id;
95
+		}
96
+		return $termIds;
97
+	}
98 98
 
99
-    /**
100
-     * @return array
101
-     */
102
-    public function getTerms(array $args = [])
103
-    {
104
-        $args = wp_parse_args($args, [
105
-            'count' => false,
106
-            'fields' => 'id=>name',
107
-            'hide_empty' => false,
108
-            'taxonomy' => Application::TAXONOMY,
109
-        ]);
110
-        $terms = get_terms($args);
111
-        if (is_wp_error($terms)) {
112
-            glsr_log()->error($terms->get_error_message());
113
-            return [];
114
-        }
115
-        return $terms;
116
-    }
99
+	/**
100
+	 * @return array
101
+	 */
102
+	public function getTerms(array $args = [])
103
+	{
104
+		$args = wp_parse_args($args, [
105
+			'count' => false,
106
+			'fields' => 'id=>name',
107
+			'hide_empty' => false,
108
+			'taxonomy' => Application::TAXONOMY,
109
+		]);
110
+		$terms = get_terms($args);
111
+		if (is_wp_error($terms)) {
112
+			glsr_log()->error($terms->get_error_message());
113
+			return [];
114
+		}
115
+		return $terms;
116
+	}
117 117
 
118
-    /**
119
-     * @param string $searchTerm
120
-     * @return void|string
121
-     */
122
-    public function searchPosts($searchTerm)
123
-    {
124
-        $args = [
125
-            'post_status' => 'publish',
126
-            'post_type' => 'any',
127
-        ];
128
-        if (is_numeric($searchTerm)) {
129
-            $args['post__in'] = [$searchTerm];
130
-        } else {
131
-            $args['orderby'] = 'relevance';
132
-            $args['posts_per_page'] = 10;
133
-            $args['s'] = $searchTerm;
134
-        }
135
-        $queryBuilder = glsr(QueryBuilder::class);
136
-        add_filter('posts_search', [$queryBuilder, 'filterSearchByTitle'], 500, 2);
137
-        $search = new WP_Query($args);
138
-        remove_filter('posts_search', [$queryBuilder, 'filterSearchByTitle'], 500);
139
-        if (!$search->have_posts()) {
140
-            return;
141
-        }
142
-        $results = '';
143
-        while ($search->have_posts()) {
144
-            $search->the_post();
145
-            ob_start();
146
-            glsr()->render('partials/editor/search-result', [
147
-                'ID' => get_the_ID(),
148
-                'permalink' => esc_url((string) get_permalink()),
149
-                'title' => esc_attr(get_the_title()),
150
-            ]);
151
-            $results.= ob_get_clean();
152
-        }
153
-        wp_reset_postdata();
154
-        return $results;
155
-    }
118
+	/**
119
+	 * @param string $searchTerm
120
+	 * @return void|string
121
+	 */
122
+	public function searchPosts($searchTerm)
123
+	{
124
+		$args = [
125
+			'post_status' => 'publish',
126
+			'post_type' => 'any',
127
+		];
128
+		if (is_numeric($searchTerm)) {
129
+			$args['post__in'] = [$searchTerm];
130
+		} else {
131
+			$args['orderby'] = 'relevance';
132
+			$args['posts_per_page'] = 10;
133
+			$args['s'] = $searchTerm;
134
+		}
135
+		$queryBuilder = glsr(QueryBuilder::class);
136
+		add_filter('posts_search', [$queryBuilder, 'filterSearchByTitle'], 500, 2);
137
+		$search = new WP_Query($args);
138
+		remove_filter('posts_search', [$queryBuilder, 'filterSearchByTitle'], 500);
139
+		if (!$search->have_posts()) {
140
+			return;
141
+		}
142
+		$results = '';
143
+		while ($search->have_posts()) {
144
+			$search->the_post();
145
+			ob_start();
146
+			glsr()->render('partials/editor/search-result', [
147
+				'ID' => get_the_ID(),
148
+				'permalink' => esc_url((string) get_permalink()),
149
+				'title' => esc_attr(get_the_title()),
150
+			]);
151
+			$results.= ob_get_clean();
152
+		}
153
+		wp_reset_postdata();
154
+		return $results;
155
+	}
156 156
 
157
-    /**
158
-     * @param int $postId
159
-     * @param string $key
160
-     * @param mixed $value
161
-     * @return int|bool
162
-     */
163
-    public function set($postId, $key, $value)
164
-    {
165
-        $key = Str::prefix('_', $key);
166
-        return update_post_meta($postId, $key, $value);
167
-    }
157
+	/**
158
+	 * @param int $postId
159
+	 * @param string $key
160
+	 * @param mixed $value
161
+	 * @return int|bool
162
+	 */
163
+	public function set($postId, $key, $value)
164
+	{
165
+		$key = Str::prefix('_', $key);
166
+		return update_post_meta($postId, $key, $value);
167
+	}
168 168
 
169
-    /**
170
-     * @param int $postId
171
-     * @param string $key
172
-     * @param mixed $value
173
-     * @return int|bool
174
-     */
175
-    public function update($postId, $key, $value)
176
-    {
177
-        return $this->set($postId, $key, $value);
178
-    }
169
+	/**
170
+	 * @param int $postId
171
+	 * @param string $key
172
+	 * @param mixed $value
173
+	 * @return int|bool
174
+	 */
175
+	public function update($postId, $key, $value)
176
+	{
177
+		return $this->set($postId, $key, $value);
178
+	}
179 179
 }
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
      * @param bool $single
19 19
      * @return mixed
20 20
      */
21
-    public function get($postId, $key, $single = true)
21
+    public function get( $postId, $key, $single = true )
22 22
     {
23
-        $key = Str::prefix('_', $key);
24
-        return get_post_meta(intval($postId), $key, $single);
23
+        $key = Str::prefix( '_', $key );
24
+        return get_post_meta( intval( $postId ), $key, $single );
25 25
     }
26 26
 
27 27
     /**
@@ -29,16 +29,16 @@  discard block
 block discarded – undo
29 29
      * @param string $assignedTo
30 30
      * @return void|WP_Post
31 31
      */
32
-    public function getAssignedToPost($postId, $assignedTo = '')
32
+    public function getAssignedToPost( $postId, $assignedTo = '' )
33 33
     {
34
-        if (empty($assignedTo)) {
35
-            $assignedTo = $this->get($postId, 'assigned_to');
34
+        if( empty($assignedTo) ) {
35
+            $assignedTo = $this->get( $postId, 'assigned_to' );
36 36
         }
37
-        if (empty($assignedTo)) {
37
+        if( empty($assignedTo) ) {
38 38
             return;
39 39
         }
40
-        $assignedPost = get_post($assignedTo);
41
-        if ($assignedPost instanceof WP_Post && $assignedPost->ID != $postId) {
40
+        $assignedPost = get_post( $assignedTo );
41
+        if( $assignedPost instanceof WP_Post && $assignedPost->ID != $postId ) {
42 42
             return $assignedPost;
43 43
         }
44 44
     }
@@ -48,25 +48,25 @@  discard block
 block discarded – undo
48 48
      * @param string $metaValue
49 49
      * @return array|int
50 50
      */
51
-    public function getReviewCount($metaKey = '', $metaValue = '')
51
+    public function getReviewCount( $metaKey = '', $metaValue = '' )
52 52
     {
53
-        if (!$metaKey) {
54
-            return (array) wp_count_posts(Application::POST_TYPE);
53
+        if( !$metaKey ) {
54
+            return (array)wp_count_posts( Application::POST_TYPE );
55 55
         }
56
-        $counts = glsr(Cache::class)->getReviewCountsFor($metaKey);
57
-        if (!$metaValue) {
56
+        $counts = glsr( Cache::class )->getReviewCountsFor( $metaKey );
57
+        if( !$metaValue ) {
58 58
             return $counts;
59 59
         }
60
-        return Arr::get($counts, $metaValue, 0);
60
+        return Arr::get( $counts, $metaValue, 0 );
61 61
     }
62 62
 
63 63
     /**
64 64
      * @param string $metaReviewType
65 65
      * @return array
66 66
      */
67
-    public function getReviewIdsByType($metaReviewType)
67
+    public function getReviewIdsByType( $metaReviewType )
68 68
     {
69
-        return glsr(SqlQueries::class)->getReviewIdsByType($metaReviewType);
69
+        return glsr( SqlQueries::class )->getReviewIdsByType( $metaReviewType );
70 70
     }
71 71
 
72 72
     /**
@@ -74,21 +74,21 @@  discard block
 block discarded – undo
74 74
      * @param string $status
75 75
      * @return array
76 76
      */
77
-    public function getReviewsMeta($key, $status = 'publish')
77
+    public function getReviewsMeta( $key, $status = 'publish' )
78 78
     {
79
-        return glsr(SqlQueries::class)->getReviewsMeta($key, $status);
79
+        return glsr( SqlQueries::class )->getReviewsMeta( $key, $status );
80 80
     }
81 81
 
82 82
     /**
83 83
      * @param string $field
84 84
      * @return array
85 85
      */
86
-    public function getTermIds(array $values, $field)
86
+    public function getTermIds( array $values, $field )
87 87
     {
88 88
         $termIds = [];
89
-        foreach ($values as $value) {
90
-            $term = get_term_by($field, $value, Application::TAXONOMY);
91
-            if (!isset($term->term_id)) {
89
+        foreach( $values as $value ) {
90
+            $term = get_term_by( $field, $value, Application::TAXONOMY );
91
+            if( !isset($term->term_id) ) {
92 92
                 continue;
93 93
             }
94 94
             $termIds[] = $term->term_id;
@@ -99,17 +99,17 @@  discard block
 block discarded – undo
99 99
     /**
100 100
      * @return array
101 101
      */
102
-    public function getTerms(array $args = [])
102
+    public function getTerms( array $args = [] )
103 103
     {
104
-        $args = wp_parse_args($args, [
104
+        $args = wp_parse_args( $args, [
105 105
             'count' => false,
106 106
             'fields' => 'id=>name',
107 107
             'hide_empty' => false,
108 108
             'taxonomy' => Application::TAXONOMY,
109
-        ]);
110
-        $terms = get_terms($args);
111
-        if (is_wp_error($terms)) {
112
-            glsr_log()->error($terms->get_error_message());
109
+        ] );
110
+        $terms = get_terms( $args );
111
+        if( is_wp_error( $terms ) ) {
112
+            glsr_log()->error( $terms->get_error_message() );
113 113
             return [];
114 114
         }
115 115
         return $terms;
@@ -119,36 +119,36 @@  discard block
 block discarded – undo
119 119
      * @param string $searchTerm
120 120
      * @return void|string
121 121
      */
122
-    public function searchPosts($searchTerm)
122
+    public function searchPosts( $searchTerm )
123 123
     {
124 124
         $args = [
125 125
             'post_status' => 'publish',
126 126
             'post_type' => 'any',
127 127
         ];
128
-        if (is_numeric($searchTerm)) {
128
+        if( is_numeric( $searchTerm ) ) {
129 129
             $args['post__in'] = [$searchTerm];
130 130
         } else {
131 131
             $args['orderby'] = 'relevance';
132 132
             $args['posts_per_page'] = 10;
133 133
             $args['s'] = $searchTerm;
134 134
         }
135
-        $queryBuilder = glsr(QueryBuilder::class);
136
-        add_filter('posts_search', [$queryBuilder, 'filterSearchByTitle'], 500, 2);
137
-        $search = new WP_Query($args);
138
-        remove_filter('posts_search', [$queryBuilder, 'filterSearchByTitle'], 500);
139
-        if (!$search->have_posts()) {
135
+        $queryBuilder = glsr( QueryBuilder::class );
136
+        add_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500, 2 );
137
+        $search = new WP_Query( $args );
138
+        remove_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500 );
139
+        if( !$search->have_posts() ) {
140 140
             return;
141 141
         }
142 142
         $results = '';
143
-        while ($search->have_posts()) {
143
+        while( $search->have_posts() ) {
144 144
             $search->the_post();
145 145
             ob_start();
146
-            glsr()->render('partials/editor/search-result', [
146
+            glsr()->render( 'partials/editor/search-result', [
147 147
                 'ID' => get_the_ID(),
148
-                'permalink' => esc_url((string) get_permalink()),
149
-                'title' => esc_attr(get_the_title()),
150
-            ]);
151
-            $results.= ob_get_clean();
148
+                'permalink' => esc_url( (string)get_permalink() ),
149
+                'title' => esc_attr( get_the_title() ),
150
+            ] );
151
+            $results .= ob_get_clean();
152 152
         }
153 153
         wp_reset_postdata();
154 154
         return $results;
@@ -160,10 +160,10 @@  discard block
 block discarded – undo
160 160
      * @param mixed $value
161 161
      * @return int|bool
162 162
      */
163
-    public function set($postId, $key, $value)
163
+    public function set( $postId, $key, $value )
164 164
     {
165
-        $key = Str::prefix('_', $key);
166
-        return update_post_meta($postId, $key, $value);
165
+        $key = Str::prefix( '_', $key );
166
+        return update_post_meta( $postId, $key, $value );
167 167
     }
168 168
 
169 169
     /**
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
      * @param mixed $value
173 173
      * @return int|bool
174 174
      */
175
-    public function update($postId, $key, $value)
175
+    public function update( $postId, $key, $value )
176 176
     {
177
-        return $this->set($postId, $key, $value);
177
+        return $this->set( $postId, $key, $value );
178 178
     }
179 179
 }
Please login to merge, or discard this patch.