PluginProbe
Assistant – Every Day Productivity Apps / 1.5.5.1
Assistant – Every Day Productivity Apps v1.5.5.1
1.5.5.1 1.5.5 trunk 0.1.0 0.2.0 0.2.1 0.2.2 0.3.0 0.3.1 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.6.0 0.7.0 0.7.0.2 0.7.0.3 0.7.0.4 0.7.0.5 0.7.0.6 0.7.0.7 0.7.0.8 0.7.0.9 0.7.1 All 72 releases
← All changes | backend/src/Data/Transformers/NotationsTransformer.php +43 -43 1.5.5 → 1.5.5.1 View file →
@@ -1,43 +1,43 @@
1 -<?php
2 -
3 -namespace FL\Assistant\Data\Transformers;
4 -
5 -use FL\Assistant\System\Contracts\TransformerAbstract;
6 -
7 -class NotationsTransformer extends TransformerAbstract {
8 -
9 - public function __invoke( \WP_Post $post ) {
10 - $meta = get_post_custom( $post->ID );
11 - $type = $meta['fl_asst_notation_type'][0];
12 - $notation = [
13 - 'id' => $post->ID,
14 - 'type' => $type,
15 - 'object_type' => $meta['fl_asst_notation_object_type'][0],
16 - 'object_id' => $meta['fl_asst_notation_object_id'][0],
17 - ];
18 -
19 - if ( 'favorite' === $type ) {
20 - return $this->transform_favorite( $post, $notation );
21 - } elseif ( 'label' === $type ) {
22 - return $this->transform_label( $post, $notation );
23 - }
24 -
25 - return $notation;
26 - }
27 -
28 - public function transform_favorite( \WP_Post $post, $notation ) {
29 - return array_merge(
30 - $notation, [
31 - 'user_id' => $post->post_author,
32 - ]
33 - );
34 - }
35 -
36 - public function transform_label( \WP_Post $post, $notation ) {
37 - return array_merge(
38 - $notation, [
39 - 'label_id' => (int) get_post_meta( $post->ID, 'fl_asst_notation_label_id', true ),
40 - ]
41 - );
42 - }
43 -}
1 +<?php
2 +
3 +namespace FL\Assistant\Data\Transformers;
4 +
5 +use FL\Assistant\System\Contracts\TransformerAbstract;
6 +
7 +class NotationsTransformer extends TransformerAbstract {
8 +
9 + public function __invoke( \WP_Post $post ) {
10 + $meta = get_post_custom( $post->ID );
11 + $type = $meta['fl_asst_notation_type'][0];
12 + $notation = [
13 + 'id' => $post->ID,
14 + 'type' => $type,
15 + 'object_type' => $meta['fl_asst_notation_object_type'][0],
16 + 'object_id' => $meta['fl_asst_notation_object_id'][0],
17 + ];
18 +
19 + if ( 'favorite' === $type ) {
20 + return $this->transform_favorite( $post, $notation );
21 + } elseif ( 'label' === $type ) {
22 + return $this->transform_label( $post, $notation );
23 + }
24 +
25 + return $notation;
26 + }
27 +
28 + public function transform_favorite( \WP_Post $post, $notation ) {
29 + return array_merge(
30 + $notation, [
31 + 'user_id' => $post->post_author,
32 + ]
33 + );
34 + }
35 +
36 + public function transform_label( \WP_Post $post, $notation ) {
37 + return array_merge(
38 + $notation, [
39 + 'label_id' => (int) get_post_meta( $post->ID, 'fl_asst_notation_label_id', true ),
40 + ]
41 + );
42 + }
43 +}