<?php

declare(strict_types=1);

namespace KupShop\GTMOldBundle\Tests;

trait GTMTestHelper
{
    public function recursivelyChangeType($data)
    {
        if ($data instanceof \stdClass) {
            $data = (array) $data;
        }

        if (!is_array($data)) {
            return $data;
        }

        $result = [];

        foreach ($data as $key => $value) {
            $result[$key] = $this->recursivelyChangeType($value);
        }

        return $result;
    }
}
