Ejemplo n.º 1
0
 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"));
 }
Ejemplo n.º 2
0
 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;
 }