當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CommonFunctions::isInt方法代碼示例

本文整理匯總了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"));
 }
開發者ID:noikiy,項目名稱:owaspbwa,代碼行數:14,代碼來源:CommonFunctionsTest.php

示例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;
 }
開發者ID:noikiy,項目名稱:owaspbwa,代碼行數:42,代碼來源:CustomizableCSVImport.php


注:本文中的CommonFunctions::isInt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。