本文整理汇总了PHP中CommonFunctions::isInt方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonFunctions::isInt方法的具体用法?PHP CommonFunctions::isInt怎么用?PHP CommonFunctions::isInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommonFunctions
的用法示例。
在下文中一共展示了CommonFunctions::isInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testIsInt
public function testIsInt()
{
$this->assertTrue(CommonFunctions::isInt("12"));
$this->assertTrue(CommonFunctions::isInt(12));
$this->assertFalse(CommonFunctions::isInt(12.1));
$this->assertFalse(CommonFunctions::isInt("12.11"));
$this->assertTrue(CommonFunctions::isInt(12.0));
$this->assertFalse(CommonFunctions::isInt("12.0"));
$this->assertTrue(CommonFunctions::isInt("-12", true));
$this->assertFalse(CommonFunctions::isInt("-12"));
$this->assertTrue(CommonFunctions::isInt("+12", true));
$this->assertFalse(CommonFunctions::isInt("+12"));
$this->assertFalse(CommonFunctions::isInt("abc"));
}
示例2: _getTaxInfo
private function _getTaxInfo($federalTaxStatus, $fedEx, $taxState, $stateTaxStatus, $stateEx, $unemploymentState, $workState)
{
$allStatuses = array(EmpTax::TAX_STATUS_MARRIED, EmpTax::TAX_STATUS_SINGLE, EmpTax::TAX_STATUS_NONRESIDENTALIEN, EmpTax::TAX_STATUS_NOTAPPLICABLE);
$taxInfo = new EmpTax();
if (!empty($federalTaxStatus)) {
if (array_search($federalTaxStatus, $allStatuses) === FALSE) {
throw new CSVImportException("Invalid Federal tax status value {$federalTaxStatus}", CSVImportException::INVALID_TYPE);
}
$taxInfo->setFederalTaxStatus($federalTaxStatus);
}
if (!empty($fedEx)) {
if (!CommonFunctions::isInt($fedEx)) {
throw new CSVImportException("Federal tax exemptions should be an integer: {$fedEx}", CSVImportException::INVALID_TYPE);
}
$taxInfo->setFederalTaxExceptions($fedEx);
}
if (!empty($taxState)) {
$state = $this->_getUSState($taxState);
$taxInfo->setTaxState($state);
}
if (!empty($stateTaxStatus)) {
if (array_search($federalTaxStatus, $allStatuses) === FALSE) {
throw new CSVImportException("Invalid State tax status value {$stateTaxStatus}", CSVImportException::INVALID_TYPE);
}
$taxInfo->setStateTaxStatus($stateTaxStatus);
}
if (!empty($stateEx)) {
if (!CommonFunctions::isInt($stateEx)) {
throw new CSVImportException("State tax exemptions should be an integer: {$stateEx}", CSVImportException::INVALID_TYPE);
}
$taxInfo->setStateTaxExceptions($stateEx);
}
if (!empty($unemploymentState)) {
$state = $this->_getUSState($unemploymentState);
$taxInfo->setTaxUnemploymentState($state);
}
if (!empty($workState)) {
$state = $this->_getUSState($workState);
$taxInfo->setTaxWorkState($state);
}
return $taxInfo;
}