@@ -4,17 +4,17 @@ discard block |
||
4 | 4 | |
5 | 5 | class PostMeta |
6 | 6 | { |
7 | - public function get( $value, array $args = [] ) |
|
7 | + public function get($value, array $args = []) |
|
8 | 8 | { |
9 | - $args = $this->normalize( $args ); |
|
10 | - $metaValue = get_post_meta( $args['ID'], $args['prefix'] . $value, $args['single'] ); |
|
9 | + $args = $this->normalize($args); |
|
10 | + $metaValue = get_post_meta($args['ID'], $args['prefix'] . $value, $args['single']); |
|
11 | 11 | |
12 | - return empty( $metaValue ) |
|
12 | + return empty($metaValue) |
|
13 | 13 | ? $args['fallback'] |
14 | 14 | : $metaValue; |
15 | 15 | } |
16 | 16 | |
17 | - protected function normalize( array $args ) |
|
17 | + protected function normalize(array $args) |
|
18 | 18 | { |
19 | 19 | $defaults = [ |
20 | 20 | 'ID' => get_the_ID(), |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | 'prefix' => 'pollux_', |
24 | 24 | ]; |
25 | 25 | |
26 | - $args = shortcode_atts( $defaults, $args ); |
|
26 | + $args = shortcode_atts($defaults, $args); |
|
27 | 27 | |
28 | - if( !empty( $value ) && $value[0] == '_' && !empty( $args['prefix'] )) { |
|
29 | - $args['prefix'] = sprintf( '_%s', rtrim( $args['prefix'], '_' )); |
|
28 | + if (!empty($value) && $value[0] == '_' && !empty($args['prefix'])) { |
|
29 | + $args['prefix'] = sprintf('_%s', rtrim($args['prefix'], '_')); |
|
30 | 30 | } |
31 | 31 | return $args; |
32 | 32 | } |