@@ -31,9 +31,8 @@ public function get_chart_args_content_count( $type = 'publish', $color = '#5347
3131 return \array_merge (
3232 $ this ->get_chart_args ( $ type , $ color ),
3333 [
34- 'count_callback ' => function ( $ activities , $ date = null ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
35- return \count ( $ activities );
36- },
34+ // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
35+ 'count_callback ' => fn ( $ activities , $ date = null ) => \count ( $ activities ),
3736 'return_data ' => [ 'label ' , 'score ' ],
3837 ]
3938 );
@@ -50,26 +49,22 @@ public function get_chart_args_content_count( $type = 'publish', $color = '#5347
5049 public function get_chart_args ( $ type = 'publish ' , $ color = '#534786 ' ) {
5150 return [
5251 'type ' => 'line ' ,
53- 'items_callback ' => function ( $ start_date , $ end_date ) use ( $ type ) {
54- return \progress_planner ()->get_activities__query ()->query_activities (
55- [
56- 'category ' => 'content ' ,
57- 'start_date ' => $ start_date ,
58- 'end_date ' => $ end_date ,
59- 'type ' => $ type ,
60- ]
61- );
62- },
52+ 'items_callback ' => fn ( $ start_date , $ end_date ) => \progress_planner ()->get_activities__query ()->query_activities (
53+ [
54+ 'category ' => 'content ' ,
55+ 'start_date ' => $ start_date ,
56+ 'end_date ' => $ end_date ,
57+ 'type ' => $ type ,
58+ ]
59+ ),
6360 'dates_params ' => [
6461 'start_date ' => \DateTime::createFromFormat ( 'Y-m-d ' , \gmdate ( 'Y-m-01 ' ) )->modify ( $ this ->get_range () ),
6562 'end_date ' => new \DateTime (),
6663 'frequency ' => $ this ->get_frequency (),
6764 'format ' => 'M ' ,
6865 ],
6966 'filter_results ' => [ $ this , 'filter_activities ' ],
70- 'color ' => function () use ( $ color ) {
71- return $ color ;
72- },
67+ 'color ' => fn () => $ color ,
7368 ];
7469 }
7570
@@ -83,11 +78,10 @@ public function get_chart_args( $type = 'publish', $color = '#534786' ) {
8378 public function filter_activities ( $ activities ) {
8479 return \array_filter (
8580 $ activities ,
86- function ( $ activity ) {
87- $ post = $ activity ->get_post ();
88- return 'delete ' === $ activity ->type || ( \is_object ( $ post )
89- && \in_array ( $ post ->post_type , \progress_planner ()->get_activities__content_helpers ()->get_post_types_names (), true ) );
90- }
81+ fn ( $ activity ) => 'delete ' === $ activity ->type
82+ || ( \is_object ( $ activity ->get_post () )
83+ && \in_array ( $ activity ->get_post ()->post_type , \progress_planner ()->get_activities__content_helpers ()->get_post_types_names (), true )
84+ )
9185 );
9286 }
9387}
0 commit comments