本文整理汇总了PHP中Number::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Number::__construct方法的具体用法?PHP Number::__construct怎么用?PHP Number::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Number
的用法示例。
在下文中一共展示了Number::__construct方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($value)
{
parent::__construct($value, 9);
if (!preg_match('/^[0-9]{9}$/', (string) $value)) {
throw new InvalidFieldException('Routing "' . $value . '" must be a 9 digit number.');
}
}
示例2: __construct
/**
* Create a new instance
*
* @param float $val Value of this float
*/
public function __construct($val)
{
parent::__construct($val);
// Validate...
if (!is_float($this->val)) {
return $this->panic();
}
}
示例3: __construct
public function __construct($value)
{
parent::__construct($value, 1);
$valid = [self::PREPARED_BY_OPERATOR, self::ORIGINATOR_IS_FI, self::ORIGINATOR_IS_EXEMPT, self::ORIGINATOR_IS_FED];
if (!in_array($value, $valid)) {
throw new InvalidFieldException('Invalid originator status code "' . $value . '".');
}
}
示例4: __construct
public function __construct($value)
{
parent::__construct($value, 2);
$valid = [self::CHECKING_DEPOSIT, self::CHECKING_CREDIT_PRENOTIFICATION, self::CHECKING_ZERO_DOLLAR, self::CHECKING_DEBIT, self::CHECKING_DEBIT_PRENOTIFICATION, self::CHECKING_DEBIT_ZERO_DOLLAR, self::SAVINGS_DEPOSIT, self::SAVINGS_CREDIT_PRENOTIFICATION, self::SAVINGS_CREDIT_ZERO_DOLLAR, self::SAVINGS_DEBIT, self::SAVINGS_DEBIT_PRENOTIFICATION, self::SAVINGS_DEBIT_ZERO_DOLLAR, self::GL_CREDIT, self::GL_DEBIT, self::GL_CREDIT_PRENOTIFICATION, self::LOAN_CREDIT, self::LOAN_REVERSAL, self::LOAN_CREDIT_PRENOTIFICATION];
if (!in_array($value, $valid)) {
throw new InvalidFieldException('Invalid transaction code "' . $value . '".');
}
}
示例5: __construct
public function __construct($value)
{
// float value, preserve decimal places
$value = number_format((double) $value, 2, '.', '');
// remove dots
$value = str_replace('.', '', $value);
if (strlen($value) > 10) {
throw new InvalidFieldException('Amount "' . $value . '" is too large.');
}
parent::__construct($value, 10);
}
示例6: __construct
public function __construct($db, $relationName, $subQuery)
{
$field = (object) array('name' => $relationName, 'type' => 'relation');
parent::__construct($db, $field);
$this->subQuery = $subQuery;
}