Skip to content

Commit

Permalink
Zend\Currency cleanup
Browse files Browse the repository at this point in the history
- s/CurrencyServiceInterface/CurrencyService/
- Updated code and tests to reflect the above
  • Loading branch information
weierophinney committed Jul 7, 2010
1 parent cbe66cc commit bc4d4ad
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions library/Zend/Currency/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ protected function _exchangeCurrency($value, $currency)
$rate = 1;
if ($currency !== $this->getShortName()) {
$service = $this->getService();
if (!($service instanceof CurrencyServiceInterface)) {
if (!($service instanceof CurrencyService)) {
throw new Exception('No exchange service applied');
}

Expand All @@ -766,7 +766,7 @@ protected function _exchangeCurrency($value, $currency)
/**
* Returns the set service class
*
* @return Zend\Currency\CurrencyServiceInterface
* @return Zend\Currency\CurrencyService
*/
public function getService()
{
Expand All @@ -776,7 +776,7 @@ public function getService()
/**
* Sets a new exchange service
*
* @param string|Zend\Currency\CurrencyServiceInterface $service Service class
* @param string|Zend\Currency\CurrencyService $service Service class
* @return Zend\Currency\Currency
*/
public function setService($service)
Expand All @@ -785,8 +785,8 @@ public function setService($service)
$service = new $service;
}

if (!($service instanceof CurrencyServiceInterface)) {
throw new Exception('A currency service must implement Zend\Currency\CurrencyServiceInterface');
if (!($service instanceof CurrencyService)) {
throw new Exception('A currency service must implement Zend\Currency\CurrencyService');
}

$this->_options['service'] = $service;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface CurrencyServiceInterface
interface CurrencyService
{
/**
* Returns the actual exchange rate
Expand Down
6 changes: 3 additions & 3 deletions tests/Zend/Currency/CurrencyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -777,10 +777,10 @@ public function testExchangeValues()

$this->assertEquals(null, $currency->getService());
$currency->setService(new ExchangeTest());
$this->assertTrue($currency->getService() instanceof Currency\CurrencyServiceInterface);
$this->assertTrue($currency->getService() instanceof Currency\CurrencyService);

$currency->setService('ZendTest\Currency\ExchangeTest');
$this->assertTrue($currency->getService() instanceof Currency\CurrencyServiceInterface);
$this->assertTrue($currency->getService() instanceof Currency\CurrencyService);
}

/**
Expand Down Expand Up @@ -811,7 +811,7 @@ public function testSetValueWithoutLocale()

$this->assertEquals(null, $currency->getService());
$currency->setService(new ExchangeTest());
$this->assertTrue($currency->getService() instanceof Currency\CurrencyServiceInterface);
$this->assertTrue($currency->getService() instanceof Currency\CurrencyService);

$currency->setValue(100, 'USD');
$this->assertEquals(50, $currency->getValue());
Expand Down
4 changes: 2 additions & 2 deletions tests/Zend/Currency/ExchangeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_Currency
*/
class ExchangeTest implements \Zend\Currency\CurrencyServiceInterface
class ExchangeTest implements \Zend\Currency\CurrencyService
{
/**
* Test method for exchange rate
Expand All @@ -52,4 +52,4 @@ public function getRate($from, $to)
return 1;
}
}
}
}
6 changes: 3 additions & 3 deletions working/PHPNamespacer-MappedClasses.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1979,10 +1979,10 @@
<mappedClass>
<originalRelativeFilePath>Zend/Currency/CurrencyInterface.php</originalRelativeFilePath>
<originalClassName>Zend_Currency_CurrencyInterface</originalClassName>
<newRelativeFilePath>Zend/Currency/CurrencyServiceInterface.php</newRelativeFilePath>
<newRelativeFilePath>Zend/Currency/CurrencyService.php</newRelativeFilePath>
<newNamespace>Zend\Currency</newNamespace>
<newClassName>CurrencyServiceInterface</newClassName>
<newFullyQualifiedName>Zend\Currency\CurrencyServiceInterface</newFullyQualifiedName>
<newClassName>CurrencyService</newClassName>
<newFullyQualifiedName>Zend\Currency\CurrencyService</newFullyQualifiedName>
</mappedClass>
<mappedClass>
<originalRelativeFilePath>Zend/Currency/Exception.php</originalRelativeFilePath>
Expand Down

0 comments on commit bc4d4ad

Please sign in to comment.