| Server IP : 85.158.181.41 / Your IP : 216.73.217.12 Web Server : Apache System : Linux cloud9-vm129 6.1.178+1-ph #ph SMP PREEMPT_DYNAMIC Wed Jul 29 09:00:54 UTC 2026 x86_64 User : moncbefd ( 1024) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/moncbefd/www.moneta.at/GXEngine/Shared/Types/ |
Upload File : |
<?php
/* --------------------------------------------------------------
IdType.inc.php 2016-03-01
Gambio GmbH
http://www.gambio.de
Copyright (c) 2016 Gambio GmbH
Released under the GNU General Public License (Version 2)
[http://www.gnu.org/licenses/gpl-2.0.html]
--------------------------------------------------------------
*/
/**
* Class IdType
*
* IMPORTANT:
* When you need to cast an Id object to integer, cast it first to string,
* because otherwise the following command will return always 1:
*
* EXAMPLE:
* $id = new IdType(948);
* bad - (int)$id >> 1
* good - (int)(string)$id >> 948
*
* @category System
* @package Shared
* @subpackage Types
*/
class IdType extends IntType implements IdInterface
{
/**
* Instance Value
*
* @var int
*/
protected $value;
/**
* Class Constructor
*
* @param int $p_value
*
* @throws InvalidArgumentException On negative values.
*/
public function __construct($p_value)
{
parent::__construct($p_value);
if ((int)$p_value < 0) {
throw new InvalidArgumentException(__CLASS__
. ': Invalid argument value given (expected positive integer got '
. gettype($p_value) . '): ' . $p_value);
}
}
/**
* @return string
* @deprecated v2.7.1.0 To string method is left for backwards compatibility. Use asInt() method instead.
*
*/
public function __toString()
{
return (string)$this->value;
}
}