<?php

namespace CouponsPlus\App\Compatibility\Wpml;

use CouponsPlus\App\Compatibility\Wpml\GettableDecorator;
use CouponsPlus\Original\Collections\Collection;

class TranslationIdsSameWhenEmpty extends GettableDecorator
{
    public function get(int $objectId): Collection
    {
        (object) $ids = $this->gettable->get($objectId);

        if ($ids->haveNone()) {
            return new Collection([$objectId]);
        }

        return $ids;
    } 
}