From bc4d4ada6d72ed11d78393927d2f45ff21a89e11 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Wed, 7 Jul 2010 08:57:49 -0400 Subject: [PATCH] Zend\Currency cleanup - s/CurrencyServiceInterface/CurrencyService/ - Updated code and tests to reflect the above --- library/Zend/Currency/Currency.php | 10 +++++----- ...urrencyServiceInterface.php => CurrencyService.php} | 2 +- tests/Zend/Currency/CurrencyTest.php | 6 +++--- tests/Zend/Currency/ExchangeTest.php | 4 ++-- working/PHPNamespacer-MappedClasses.xml | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) rename library/Zend/Currency/{CurrencyServiceInterface.php => CurrencyService.php} (97%) diff --git a/library/Zend/Currency/Currency.php b/library/Zend/Currency/Currency.php index d5363575efe..58b75f65f18 100644 --- a/library/Zend/Currency/Currency.php +++ b/library/Zend/Currency/Currency.php @@ -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'); } @@ -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() { @@ -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) @@ -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; diff --git a/library/Zend/Currency/CurrencyServiceInterface.php b/library/Zend/Currency/CurrencyService.php similarity index 97% rename from library/Zend/Currency/CurrencyServiceInterface.php rename to library/Zend/Currency/CurrencyService.php index 55b59c86fe2..8f6e6adb577 100644 --- a/library/Zend/Currency/CurrencyServiceInterface.php +++ b/library/Zend/Currency/CurrencyService.php @@ -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 diff --git a/tests/Zend/Currency/CurrencyTest.php b/tests/Zend/Currency/CurrencyTest.php index 61cc8c72381..085dfd0f139 100644 --- a/tests/Zend/Currency/CurrencyTest.php +++ b/tests/Zend/Currency/CurrencyTest.php @@ -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); } /** @@ -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()); diff --git a/tests/Zend/Currency/ExchangeTest.php b/tests/Zend/Currency/ExchangeTest.php index ffdbbde15c0..d3a255f9415 100644 --- a/tests/Zend/Currency/ExchangeTest.php +++ b/tests/Zend/Currency/ExchangeTest.php @@ -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 @@ -52,4 +52,4 @@ public function getRate($from, $to) return 1; } } -} \ No newline at end of file +} diff --git a/working/PHPNamespacer-MappedClasses.xml b/working/PHPNamespacer-MappedClasses.xml index e4bf5f7ec91..1bac361ff62 100644 --- a/working/PHPNamespacer-MappedClasses.xml +++ b/working/PHPNamespacer-MappedClasses.xml @@ -1979,10 +1979,10 @@ Zend/Currency/CurrencyInterface.php Zend_Currency_CurrencyInterface - Zend/Currency/CurrencyServiceInterface.php + Zend/Currency/CurrencyService.php Zend\Currency - CurrencyServiceInterface - Zend\Currency\CurrencyServiceInterface + CurrencyService + Zend\Currency\CurrencyService Zend/Currency/Exception.php