本文整理匯總了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;
}