. */ declare(strict_types=1); namespace FireflyIII\Transformers; use FireflyIII\Models\RuleTrigger; use League\Fractal\TransformerAbstract; use Symfony\Component\HttpFoundation\ParameterBag; /** * Class RuleTriggerTransformer */ class RuleTriggerTransformer extends TransformerAbstract { /** * List of resources possible to include * * @var array */ protected $availableIncludes = []; /** * List of resources to automatically include * * @var array */ protected $defaultIncludes = []; /** @var ParameterBag */ protected $parameters; /** * CurrencyTransformer constructor. * * @codeCoverageIgnore * * @param ParameterBag $parameters */ public function __construct(ParameterBag $parameters) { $this->parameters = $parameters; } /** * Transform the rule trigger. * * @param RuleTrigger $ruleTrigger * * @return array */ public function transform(RuleTrigger $ruleTrigger): array { $data = [ 'id' => (int)$ruleTrigger->id, 'updated_at' => $ruleTrigger->updated_at->toAtomString(), 'created_at' => $ruleTrigger->created_at->toAtomString(), 'trigger_type' => $ruleTrigger->trigger_type, 'trigger_value' => $ruleTrigger->trigger_value, 'order' => $ruleTrigger->order, 'active' => $ruleTrigger->active, 'stop_processing' => $ruleTrigger->stop_processing, 'links' => [ [ 'rel' => 'self', 'uri' => '/rule_triggers/' . $ruleTrigger->id, ], ], ]; return $data; } }