public function __construct($tokens, $unit) { if (!isset(self::$unitMap[$unit])) { throw new \InvalidArgumentException("Not a valid unit."); } if ($tokens <= 0) { throw new \InvalidArgumentException("Amount of tokens should be greater then 0."); } $this->tokens = $tokens; $this->unit = $unit; }