public function GetServiceTA($service, $continue = TRUE)
	{
		if (file_exists($this->TA_FOLDER.'TA-'.$this->options['CUIT'].'-'.$service.'.xml')) {
			$TA = new SimpleXMLElement(file_get_contents($this->TA_FOLDER.'TA-'.$this->options['CUIT'].'-'.$service.'.xml'));

			$actual_time 		= new DateTime(date('c',date('U')+600));
			$expiration_time 	= new DateTime($TA->header->expirationTime);

			if ($actual_time < $expiration_time) 
				return new TokenAutorization($TA->credentials->token, $TA->credentials->sign);
			else if ($continue === FALSE)
				throw new Exception("Error Getting TA", 5);
		}

		if ($this->CreateServiceTA($service)) 
			return $this->GetServiceTA($service, FALSE);
	}
public function GetServiceTA($service, $continue = TRUE)
	{
		if (file_exists($this->TA_FOLDER.'TA-'.$this->options['CUIT'].'-'.$service.'.xml')) {
			$TA = new SimpleXMLElement(file_get_contents($this->TA_FOLDER.'TA-'.$this->options['CUIT'].'-'.$service.'.xml'));

			$actual_time 		= new DateTime(date('c',date('U')+600));
			$expiration_time 	= new DateTime($TA->header->expirationTime);

			if ($actual_time < $expiration_time) 
				return new TokenAutorization($TA->credentials->token, $TA->credentials->sign);
			else if ($continue === FALSE)
				throw new Exception("Error Getting TA", 5);
		}

		if ($this->CreateServiceTA($service)) 
			return $this->GetServiceTA($service, FALSE);
	}
public function GetServiceTA ( $ service , $ continue = TRUE ) { if ( file_exists ( $ this -> TA_FOLDER . 'TA-' . $ this -> options [ 'CUIT' ] . '-' . $ service . '.xml' ) ) { $ TA = new SimpleXMLElement ( file_get_contents ( $ this -> TA_FOLDER . 'TA-' . $ this -> options [ 'CUIT' ] . '-' . $ service . '.xml' ) ) ; $ actual_time = new DateTime ( date ( 'c' , date ( 'U' ) + 600 ) ) ; $ expiration_time = new DateTime ( $ TA -> header -> expirationTime ) ; if ( $ actual_time < $ expiration_time ) return new TokenAutorization ( $ TA -> credentials -> token , $ TA -> credentials -> sign ) ; else if ( $ continue === FALSE ) throw new Exception ( "Error Getting TA" , 5 ) ; } if ( $ this -> CreateServiceTA ( $ service ) ) return $ this -> GetServiceTA ( $ service , FALSE ) ; }
Gets token authorization for an AFIP Web Service

@since 0.1

@param string $service Service for token authorization

@throws Exception if an error occurs

@return TokenAutorization Token Autorization for AFIP Web Service
Gets token authorization for an AFIP Web Service