. */ declare(strict_types=1); namespace FireflyIII\Transformers; /** * Class TransactionGroupTransformer */ class TransactionGroupTransformer extends AbstractTransformer { /** * Constructor. * * @codeCoverageIgnore */ public function __construct() { if ('testing' === config('app.env')) { app('log')->warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this))); } } /** * @param array $group * * @return array */ public function transform(array $group): array { $first =reset($group['transactions']); $data = [ 'id' => (int)$first['transaction_group_id'], 'created_at' => $first['created_at']->toAtomString(), 'updated_at' => $first['updated_at']->toAtomString(), 'some_field' => 'some_value', 'links' => [ [ 'rel' => 'self', 'uri' => '/transactions/' . $first['transaction_group_id'], ], ], ]; // do something else. return $data; } }