<?php

namespace CouponsPlus\App\Coupon\Tree\Factories;

use CouponsPlus\App\Coupon\Tree\Abilities;
use CouponsPlus\App\Coupon\Tree\Abilities\CreatableFromJSON;

class TestableGroupDataFromJSONFactory implements CreatableFromJSON
{
    private $testableGroupFromstdClassDataFactory;

    public function __construct(TestableGroupDataFromStandardObjectFactory $testableGroupFromstdClassDataFactory)
    {
        $this->testableGroupFromstdClassDataFactory = $testableGroupFromstdClassDataFactory;
    } 

    public function create(string $json) : Abilities\TestableGroupData
    {
        return $this->testableGroupFromstdClassDataFactory->create(
            json_decode($json, $associativeArray = null, $depth = 1024, defined('JSON_THROW_ON_ERROR')? JSON_THROW_ON_ERROR : null)
        );
    }
}