Capability.php
28 lines
| 1 | <?php declare(strict_types = 1); |
| 2 | |
| 3 | namespace MailPoet\Util\License\Features\Data; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | class Capability { |
| 9 | public const TYPE_BOOLEAN = 'boolean'; |
| 10 | public const TYPE_NUMBER = 'number'; |
| 11 | public string $name; |
| 12 | public string $type; |
| 13 | public ?int $value; |
| 14 | public bool $isRestricted; |
| 15 | |
| 16 | public function __construct( |
| 17 | string $name, |
| 18 | string $type = self::TYPE_BOOLEAN, |
| 19 | bool $isRestricted = false, |
| 20 | ?int $value = null |
| 21 | ) { |
| 22 | $this->name = $name; |
| 23 | $this->type = $type; |
| 24 | $this->value = ($type === self::TYPE_NUMBER) ? $value : null; |
| 25 | $this->isRestricted = $isRestricted; |
| 26 | } |
| 27 | } |
| 28 |