public static function fromAssociativeArray(array $data): BusinessHours
    {
        if (!isset($data['days'], $data['timezone']) || !\is_array($data['days'])) {
            throw new \InvalidArgumentException('Array is not valid.');
        }

        $days = [];
        foreach ($data['days'] as $day) {
            $days[] = DayBuilder::fromAssociativeArray($day);
        }

        return new BusinessHours($days, new \DateTimeZone($data['timezone']));
    }
public static function fromAssociativeArray(array $data): BusinessHours
    {
        if (!isset($data['days'], $data['timezone']) || !\is_array($data['days'])) {
            throw new \InvalidArgumentException('Array is not valid.');
        }

        $days = [];
        foreach ($data['days'] as $day) {
            $days[] = DayBuilder::fromAssociativeArray($day);
        }

        return new BusinessHours($days, new \DateTimeZone($data['timezone']));
    }
public static function fromAssociativeArray ( array $ data ) : BusinessHours { if ( ! isset ( $ data [ 'days' ] , $ data [ 'timezone' ] ) || ! \ is_array ( $ data [ 'days' ] ) ) { throw new \ InvalidArgumentException ( 'Array is not valid.' ) ; } $ days = [ ] ; foreach ( $ data [ 'days' ] as $ day ) { $ days [ ] = DayBuilder :: fromAssociativeArray ( $ day ) ; } return new BusinessHours ( $ days , new \ DateTimeZone ( $ data [ 'timezone' ] ) ) ; }
Build a BusinessHours from an array.

@param array $data The business hours data.
@return BusinessHours
Build a BusinessHours from an array .