Passed
Push — develop ( 9bfb1a...51b9ff )
by Paul
03:13
created
src/Helpers/PostMeta.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -10,51 +10,51 @@
 block discarded – undo
10 10
  */
11 11
 class PostMeta
12 12
 {
13
-    /**
14
-     * @param string $metaKey
15
-     * @return mixed
16
-     */
17
-    public function get($metaKey, array $args = [])
18
-    {
19
-        if (empty($metaKey)) {
20
-            return;
21
-        }
13
+	/**
14
+	 * @param string $metaKey
15
+	 * @return mixed
16
+	 */
17
+	public function get($metaKey, array $args = [])
18
+	{
19
+		if (empty($metaKey)) {
20
+			return;
21
+		}
22 22
 
23
-        $args = $this->normalize($args);
24
-        $metaKey = $this->buildMetaKey($metaKey, $args['prefix']);
25
-        $metaValue = get_post_meta($args['id'], $metaKey, $args['single']);
23
+		$args = $this->normalize($args);
24
+		$metaKey = $this->buildMetaKey($metaKey, $args['prefix']);
25
+		$metaValue = get_post_meta($args['id'], $metaKey, $args['single']);
26 26
 
27
-        if (is_string($metaValue)) {
28
-            $metaValue = trim($metaValue);
29
-        }
30
-        return empty($metaValue) && !in_array($metaValue, [0,'0'])
31
-            ? $args['fallback']
32
-            : $metaValue;
33
-    }
27
+		if (is_string($metaValue)) {
28
+			$metaValue = trim($metaValue);
29
+		}
30
+		return empty($metaValue) && !in_array($metaValue, [0,'0'])
31
+			? $args['fallback']
32
+			: $metaValue;
33
+	}
34 34
 
35
-    /**
36
-     * @param string $metaKey
37
-     * @param string $prefix
38
-     * @return string
39
-     */
40
-    protected function buildMetaKey($metaKey, $prefix)
41
-    {
42
-        return ('_' == substr($metaKey, 0, 1) && !empty($prefix))
43
-            ? sprintf('_%s%s', rtrim($prefix, '_'), $metaKey)
44
-            : $prefix.$metaKey;
45
-    }
35
+	/**
36
+	 * @param string $metaKey
37
+	 * @param string $prefix
38
+	 * @return string
39
+	 */
40
+	protected function buildMetaKey($metaKey, $prefix)
41
+	{
42
+		return ('_' == substr($metaKey, 0, 1) && !empty($prefix))
43
+			? sprintf('_%s%s', rtrim($prefix, '_'), $metaKey)
44
+			: $prefix.$metaKey;
45
+	}
46 46
 
47
-    /**
48
-     * @return array
49
-     */
50
-    protected function normalize(array $args)
51
-    {
52
-        $defaults = [
53
-            'id' => get_the_ID(),
54
-            'fallback' => '',
55
-            'single' => true,
56
-            'prefix' => apply_filters('pollux/prefix', 'pollux_'),
57
-        ];
58
-        return shortcode_atts($defaults, array_change_key_case($args));
59
-    }
47
+	/**
48
+	 * @return array
49
+	 */
50
+	protected function normalize(array $args)
51
+	{
52
+		$defaults = [
53
+			'id' => get_the_ID(),
54
+			'fallback' => '',
55
+			'single' => true,
56
+			'prefix' => apply_filters('pollux/prefix', 'pollux_'),
57
+		];
58
+		return shortcode_atts($defaults, array_change_key_case($args));
59
+	}
60 60
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -14,20 +14,20 @@  discard block
 block discarded – undo
14 14
      * @param string $metaKey
15 15
      * @return mixed
16 16
      */
17
-    public function get($metaKey, array $args = [])
17
+    public function get( $metaKey, array $args = [] )
18 18
     {
19
-        if (empty($metaKey)) {
19
+        if( empty( $metaKey ) ) {
20 20
             return;
21 21
         }
22 22
 
23
-        $args = $this->normalize($args);
24
-        $metaKey = $this->buildMetaKey($metaKey, $args['prefix']);
25
-        $metaValue = get_post_meta($args['id'], $metaKey, $args['single']);
23
+        $args = $this->normalize( $args );
24
+        $metaKey = $this->buildMetaKey( $metaKey, $args['prefix'] );
25
+        $metaValue = get_post_meta( $args['id'], $metaKey, $args['single'] );
26 26
 
27
-        if (is_string($metaValue)) {
28
-            $metaValue = trim($metaValue);
27
+        if( is_string( $metaValue ) ) {
28
+            $metaValue = trim( $metaValue );
29 29
         }
30
-        return empty($metaValue) && !in_array($metaValue, [0,'0'])
30
+        return empty( $metaValue ) && !in_array( $metaValue, [0, '0'] )
31 31
             ? $args['fallback']
32 32
             : $metaValue;
33 33
     }
@@ -37,24 +37,24 @@  discard block
 block discarded – undo
37 37
      * @param string $prefix
38 38
      * @return string
39 39
      */
40
-    protected function buildMetaKey($metaKey, $prefix)
40
+    protected function buildMetaKey( $metaKey, $prefix )
41 41
     {
42
-        return ('_' == substr($metaKey, 0, 1) && !empty($prefix))
43
-            ? sprintf('_%s%s', rtrim($prefix, '_'), $metaKey)
42
+        return ( '_' == substr( $metaKey, 0, 1 ) && !empty( $prefix ) )
43
+            ? sprintf( '_%s%s', rtrim( $prefix, '_' ), $metaKey )
44 44
             : $prefix.$metaKey;
45 45
     }
46 46
 
47 47
     /**
48 48
      * @return array
49 49
      */
50
-    protected function normalize(array $args)
50
+    protected function normalize( array $args )
51 51
     {
52 52
         $defaults = [
53 53
             'id' => get_the_ID(),
54 54
             'fallback' => '',
55 55
             'single' => true,
56
-            'prefix' => apply_filters('pollux/prefix', 'pollux_'),
56
+            'prefix' => apply_filters( 'pollux/prefix', 'pollux_' ),
57 57
         ];
58
-        return shortcode_atts($defaults, array_change_key_case($args));
58
+        return shortcode_atts( $defaults, array_change_key_case( $args ) );
59 59
     }
60 60
 }
Please login to merge, or discard this patch.