/home/sharedstore/public_html/prestashop.sharedstore.ma/src/Core/Domain/Tab/ValueObject
Edit: /home/sharedstore/public_html/prestashop.sharedstore.ma/src/Core/Domain/Tab/ValueObject/TabId.php (1974B)
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
declare(strict_types=1);
namespace PrestaShop\PrestaShop\Core\Domain\Tab\ValueObject;
use PrestaShop\PrestaShop\Core\Domain\Tab\Exception\InvalidTabValueIdException;
class TabId implements TabIdInterface
{
/**
* @var int
*/
private $tabId;
/**
* @param int $tabId
*/
public function __construct(int $tabId)
{
$this->assertTabIdIsGreaterThanZero($tabId);
$this->tabId = $tabId;
}
/**
* @return int
*/
public function getValue(): int
{
return $this->tabId;
}
/**
* @param int $tabId
*
* @throws InvalidTabValueIdException
*/
private function assertTabIdIsGreaterThanZero(int $tabId): void
{
if (0 >= $tabId) {
throw new InvalidTabValueIdException(
sprintf('Invalid tab id "%d" provided', $tabId)
);
}
}
}