| 
									
										
										
										
											2018-06-24 06:51:22 +02:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * RuleGroupTransformer.php | 
					
						
							| 
									
										
										
										
											2020-02-16 13:57:18 +01:00
										 |  |  |  * Copyright (c) 2019 james@firefly-iii.org | 
					
						
							| 
									
										
										
										
											2018-06-24 06:51:22 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2019-10-02 06:37:26 +02:00
										 |  |  |  * This file is part of Firefly III (https://github.com/firefly-iii). | 
					
						
							| 
									
										
										
										
											2018-06-24 06:51:22 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2019-10-02 06:37:26 +02:00
										 |  |  |  * This program is free software: you can redistribute it and/or modify | 
					
						
							|  |  |  |  * it under the terms of the GNU Affero General Public License as | 
					
						
							|  |  |  |  * published by the Free Software Foundation, either version 3 of the | 
					
						
							|  |  |  |  * License, or (at your option) any later version. | 
					
						
							| 
									
										
										
										
											2018-06-24 06:51:22 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2019-10-02 06:37:26 +02:00
										 |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							| 
									
										
										
										
											2018-06-24 06:51:22 +02:00
										 |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							| 
									
										
										
										
											2019-10-02 06:37:26 +02:00
										 |  |  |  * GNU Affero General Public License for more details. | 
					
						
							| 
									
										
										
										
											2018-06-24 06:51:22 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2019-10-02 06:37:26 +02:00
										 |  |  |  * You should have received a copy of the GNU Affero General Public License | 
					
						
							|  |  |  |  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | 
					
						
							| 
									
										
										
										
											2018-06-24 06:51:22 +02:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | declare(strict_types=1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace FireflyIII\Transformers; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | use FireflyIII\Models\RuleGroup; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Class RuleGroupTransformer | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2018-12-15 22:03:42 +01:00
										 |  |  | class RuleGroupTransformer extends AbstractTransformer | 
					
						
							| 
									
										
										
										
											2018-06-24 06:51:22 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Transform the rule group | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function transform(RuleGroup $ruleGroup): array | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2020-10-23 19:11:25 +02:00
										 |  |  |         return [ | 
					
						
							| 
									
										
										
										
											2023-11-05 19:55:39 +01:00
										 |  |  |             'id'          => $ruleGroup->id, | 
					
						
							| 
									
										
										
										
											2018-12-07 07:49:16 +01:00
										 |  |  |             'created_at'  => $ruleGroup->created_at->toAtomString(), | 
					
						
							| 
									
										
										
										
											2018-12-12 20:30:25 +01:00
										 |  |  |             'updated_at'  => $ruleGroup->updated_at->toAtomString(), | 
					
						
							| 
									
										
										
										
											2018-12-07 07:49:16 +01:00
										 |  |  |             'title'       => $ruleGroup->title, | 
					
						
							|  |  |  |             'description' => $ruleGroup->description, | 
					
						
							|  |  |  |             'order'       => $ruleGroup->order, | 
					
						
							|  |  |  |             'active'      => $ruleGroup->active, | 
					
						
							|  |  |  |             'links'       => [ | 
					
						
							| 
									
										
										
										
											2018-06-24 06:51:22 +02:00
										 |  |  |                 [ | 
					
						
							|  |  |  |                     'rel' => 'self', | 
					
						
							| 
									
										
										
										
											2023-12-20 19:35:52 +01:00
										 |  |  |                     'uri' => '/rule_groups/'.$ruleGroup->id, | 
					
						
							| 
									
										
										
										
											2018-06-24 06:51:22 +02:00
										 |  |  |                 ], | 
					
						
							|  |  |  |             ], | 
					
						
							|  |  |  |         ]; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |