Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #12 from Maks3w/locale-renamed-interfaces

Locale renamed interfaces
  • Loading branch information...
commit 0b5ff94e1b2e860830fa3f5405c52c368d9ab61e 2 parents d7d4278 + 6028188
prolic authored May 16, 2012
22  library/Zend/Currency/Currency.php
@@ -84,7 +84,7 @@ class Currency
84 84
      *
85 85
      * @param  string|array       $options OPTIONAL Options array or currency short name
86 86
      *                                              when string is given
87  
-     * @param  string|Zend\Locale\Locale $locale  OPTIONAL locale name
  87
+     * @param  string|\Zend\Locale\Locale $locale  OPTIONAL locale name
88 88
      * @throws Zend\Currency\Exception   When currency is invalid
89 89
      */
90 90
     public function __construct($options = null, $locale = null)
@@ -284,9 +284,9 @@ public function setFormat(array $options = array())
284 284
     /**
285 285
      * Internal function for checking static given locale parameter
286 286
      *
287  
-     * @param  string                    $currency (Optional) Currency name
288  
-     * @param  string|Zend\Locale\Locale $locale   (Optional) Locale to display informations
289  
-     * @throws Zend\Currency\Exception   When locale contains no region
  287
+     * @param  string                     $currency (Optional) Currency name
  288
+     * @param  string|\Zend\Locale\Locale $locale   (Optional) Locale to display informations
  289
+     * @throws Zend\Currency\Exception    When locale contains no region
290 290
      * @return string The extracted locale representation as string
291 291
      */
292 292
     private function _checkParams($currency = null, $locale = null)
@@ -321,8 +321,8 @@ private function _checkParams($currency = null, $locale = null)
321 321
      * Returns the actual or details of other currency symbols,
322 322
      * when no symbol is available it returns the currency shortname (f.e. FIM for Finnian Mark)
323 323
      *
324  
-     * @param  string                    $currency (Optional) Currency name
325  
-     * @param  string|Zend\Locale\Locale $locale   (Optional) Locale to display informations
  324
+     * @param  string                     $currency (Optional) Currency name
  325
+     * @param  string|\Zend\Locale\Locale $locale   (Optional) Locale to display informations
326 326
      * @return string
327 327
      */
328 328
     public function getSymbol($currency = null, $locale = null)
@@ -349,8 +349,8 @@ public function getSymbol($currency = null, $locale = null)
349 349
     /**
350 350
      * Returns the actual or details of other currency shortnames
351 351
      *
352  
-     * @param  string                    $currency OPTIONAL Currency's name
353  
-     * @param  string|Zend\Locale\Locale $locale   OPTIONAL The locale
  352
+     * @param  string                     $currency OPTIONAL Currency's name
  353
+     * @param  string|\Zend\Locale\Locale $locale   OPTIONAL The locale
354 354
      * @return string
355 355
      */
356 356
     public function getShortName($currency = null, $locale = null)
@@ -384,8 +384,8 @@ public function getShortName($currency = null, $locale = null)
384 384
     /**
385 385
      * Returns the actual or details of other currency names
386 386
      *
387  
-     * @param  string                    $currency (Optional) Currency's short name
388  
-     * @param  string|Zend\Locale\Locale $locale   (Optional) The locale
  387
+     * @param  string                     $currency (Optional) Currency's short name
  388
+     * @param  string|\Zend\Locale\Locale $locale   (Optional) The locale
389 389
      * @return string
390 390
      */
391 391
     public function getName($currency = null, $locale = null)
@@ -530,7 +530,7 @@ public static function clearCache($tag = null)
530 530
      * Example: 'de_XX' will be set to 'de' because 'de_XX' does not exist
531 531
      * 'xx_YY' will be set to 'root' because 'xx' does not exist
532 532
      *
533  
-     * @param  string|Zend\Locale\Locale $locale (Optional) Locale for parsing input
  533
+     * @param  string|\Zend\Locale\Locale $locale (Optional) Locale for parsing input
534 534
      * @throws Zend\Currency\Exception When the given locale does not exist
535 535
      * @return Zend\Currency Provides fluent interface
536 536
      */
11  library/Zend/Locale/Data/AbstractLocale.php
@@ -23,7 +23,8 @@
23 23
 
24 24
 use Zend\Cache\Storage\Adapter\AdapterInterface as CacheAdapter,
25 25
     Zend\Locale\Locale,
26  
-    Zend\Locale\Exception\InvalidArgumentException;
  26
+    Zend\Locale\Exception\InvalidArgumentException,
  27
+    Zend\Locale\Exception\UnsupportedMethodException;
27 28
 
28 29
 /**
29 30
  * Locale data reader, handles the CLDR
@@ -194,7 +195,7 @@ protected static function _getTagSupportForCache()
194 195
      */
195 196
     public static function getDisplayLanguage($locale, $invert = false, $detail = null)
196 197
     {
197  
-        throw new UnsupportedMethod('This implementation does not support the selected locale information');
  198
+        throw new UnsupportedMethodException('This implementation does not support the selected locale information');
198 199
     }
199 200
 
200 201
     /**
@@ -208,7 +209,7 @@ public static function getDisplayLanguage($locale, $invert = false, $detail = nu
208 209
      */
209 210
     public static function getDisplayScript($locale, $invert = false, $detail = null)
210 211
     {
211  
-        throw new UnsupportedMethod('This implementation does not support the selected locale information');
  212
+        throw new UnsupportedMethodException('This implementation does not support the selected locale information');
212 213
     }
213 214
 
214 215
     /**
@@ -222,7 +223,7 @@ public static function getDisplayScript($locale, $invert = false, $detail = null
222 223
      */
223 224
     public static function getDisplayTerritory($locale, $invert = false, $detail = null)
224 225
     {
225  
-        throw new UnsupportedMethod('This implementation does not support the selected locale information');
  226
+        throw new UnsupportedMethodException('This implementation does not support the selected locale information');
226 227
     }
227 228
 
228 229
     /**
@@ -236,7 +237,7 @@ public static function getDisplayTerritory($locale, $invert = false, $detail = n
236 237
      */
237 238
     public static function getDisplayVariant($locale, $invert = false, $detail = null)
238 239
     {
239  
-        throw new UnsupportedMethod('This implementation does not support the selected locale information');
  240
+        throw new UnsupportedMethodException('This implementation does not support the selected locale information');
240 241
     }
241 242
 
242 243
 /**
4  library/Zend/Locale/Data/Cldr.php
@@ -139,7 +139,7 @@ private static function _findRoute($locale, $path, $attribute, $value, &$temp)
139 139
         if (empty(self::$_ldml[(string) $locale])) {
140 140
             $filename = self::getPath() . '/' . $locale . '.xml';
141 141
             if (!file_exists($filename)) {
142  
-                throw new InvalidArgumentException(
  142
+                throw new Exception\InvalidArgumentException(
143 143
                   "Missing locale file '$filename'"
144 144
                 );
145 145
             }
@@ -1362,7 +1362,7 @@ public static function getContent($locale, $path, $value = false)
1362 1362
     /**
1363 1363
      * Internal function for checking the locale
1364 1364
      *
1365  
-     * @param string|\Zend\Locale $locale Locale to check
  1365
+     * @param string|Locale $locale Locale to check
1366 1366
      * @return string
1367 1367
      */
1368 1368
     protected static function _checkLocale($locale)
7  library/Zend/Locale/Exception/UnsupportedMethodException.php
... ...
@@ -0,0 +1,7 @@
  1
+<?php
  2
+namespace Zend\Locale\Exception;
  3
+
  4
+class UnsupportedMethodException
  5
+    extends \RuntimeException
  6
+    implements ExceptionInterface
  7
+{}
2  library/Zend/Locale/Exception/UnsupportedTokenException.php
... ...
@@ -1,7 +1,7 @@
1 1
 <?php
2 2
 namespace Zend\Locale\Exception;
3 3
 
4  
-class UnsupportedMethod
  4
+class UnsupportedTokenException
5 5
     extends \RuntimeException
6 6
     implements ExceptionInterface
7 7
 {}
32  library/Zend/Measure/AbstractMeasure.php
@@ -62,9 +62,9 @@
62 62
     /**
63 63
      * Zend\Measure\MeasureAbstract is an abstract class for the different measurement types
64 64
      *
65  
-     * @param  mixed       $value  Value as string, integer, real or float
66  
-     * @param  string      $type   OPTIONAL a measure type f.e. Zend\Measure\Length::METER
67  
-     * @param  Zend_Locale $locale OPTIONAL a Zend\Zend\Locale Type
  65
+     * @param  mixed               $value  Value as string, integer, real or float
  66
+     * @param  string              $type   OPTIONAL a measure type f.e. Zend\Measure\Length::METER
  67
+     * @param  \Zend\Locale\Locale $locale OPTIONAL a Zend\Zend\Locale Type
68 68
      * @throws Zend\Measure\Exception
69 69
      */
70 70
     public function __construct($value, $type = null, $locale = null)
@@ -99,8 +99,8 @@ public function getLocale()
99 99
     /**
100 100
      * Sets a new locale for the value representation
101 101
      *
102  
-     * @param string|Zend\Locale\Locale $locale (Optional) New locale to set
103  
-     * @param boolean                   $check  False, check but don't set; True, set the new locale
  102
+     * @param string|\Zend\Locale\Locale $locale (Optional) New locale to set
  103
+     * @param boolean                    $check  False, check but don't set; True, set the new locale
104 104
      * @return Zend\Measure\AbstractMeasure
105 105
      */
106 106
     public function setLocale($locale = null, $check = false)
@@ -132,9 +132,9 @@ public function setLocale($locale = null, $check = false)
132 132
     /**
133 133
      * Returns the internal value
134 134
      *
135  
-     * @param integer                   $round  (Optional) Rounds the value to an given precision,
136  
-     *                                                     Default is -1 which returns without rounding
137  
-     * @param string|Zend\Locale\Locale $locale (Optional) Locale for number representation
  135
+     * @param integer                    $round  (Optional) Rounds the value to an given precision,
  136
+     *                                                      Default is -1 which returns without rounding
  137
+     * @param string|\Zend\Locale\Locale $locale (Optional) Locale for number representation
138 138
      * @return integer|string
139 139
      */
140 140
     public function getValue($round = -1, $locale = null)
@@ -156,9 +156,9 @@ public function getValue($round = -1, $locale = null)
156 156
     /**
157 157
      * Set a new value
158 158
      *
159  
-     * @param  integer|string             $value   Value as string, integer, real or float
160  
-     * @param  string                     $type    OPTIONAL A measure type f.e. Zend_Measure_Length::METER
161  
-     * @param  string|Zend\Locale\Locale  $locale  OPTIONAL Locale for parsing numbers
  159
+     * @param  integer|string              $value   Value as string, integer, real or float
  160
+     * @param  string                      $type    OPTIONAL A measure type f.e. Zend_Measure_Length::METER
  161
+     * @param  string|\Zend\Locale\Locale  $locale  OPTIONAL Locale for parsing numbers
162 162
      * @throws Zend\Measure\Exception
163 163
      * @return Zend\Measure\AbstractMeasure
164 164
      */
@@ -292,8 +292,8 @@ public function equals($object)
292 292
     /**
293 293
      * Returns a string representation
294 294
      *
295  
-     * @param  integer                   $round  (Optional) Runds the value to an given exception
296  
-     * @param  string|Zend\Locale\Locale $locale (Optional) Locale to set for the number
  295
+     * @param  integer                    $round  (Optional) Runds the value to an given exception
  296
+     * @param  string|\Zend\Locale\Locale $locale (Optional) Locale to set for the number
297 297
      * @return string
298 298
      */
299 299
     public function toString($round = -1, $locale = null)
@@ -328,9 +328,9 @@ public function getConversionList()
328 328
     /**
329 329
      * Alias function for setType returning the converted unit
330 330
      *
331  
-     * @param  string                    $type   Constant Type
332  
-     * @param  integer                   $round  (Optional) Rounds the value to a given precision
333  
-     * @param  string|Zend\Locale\Locale $locale (Optional) Locale to set for the number
  331
+     * @param  string                     $type   Constant Type
  332
+     * @param  integer                    $round  (Optional) Rounds the value to a given precision
  333
+     * @param  string|\Zend\Locale\Locale $locale (Optional) Locale to set for the number
334 334
      * @return string
335 335
      */
336 336
     public function convertTo($type, $round = 2, $locale = null)
12  library/Zend/Measure/Number.php
@@ -132,9 +132,9 @@ class Number extends AbstractMeasure
132 132
     /**
133 133
      * Zend\Measure\AbstractMeasure is an abstract class for the different measurement types
134 134
      *
135  
-     * @param  integer                   $value  Value
136  
-     * @param  string                    $type   (Optional) A Zend\Measure\Number Type
137  
-     * @param  string|Zend\Locale\Locale $locale (Optional) A Zend\Locale\Locale
  135
+     * @param  integer                    $value  Value
  136
+     * @param  string                     $type   (Optional) A Zend\Measure\Number Type
  137
+     * @param  string|\Zend\Locale\Locale $locale (Optional) A Zend\Locale\Locale
138 138
      * @throws Zend\Measure\Exception When language is unknown
139 139
      * @throws Zend\Measure\Exception When type is unknown
140 140
      */
@@ -173,9 +173,9 @@ public function __construct($value, $type, $locale = null)
173 173
     /**
174 174
      * Set a new value
175 175
      *
176  
-     * @param  integer                   $value  Value
177  
-     * @param  string                    $type   (Optional) A Zend\Measure\Number Type
178  
-     * @param  string|Zend\Locale\Locale $locale (Optional) A Zend\Locale\Locale Type
  176
+     * @param  integer                    $value  Value
  177
+     * @param  string                     $type   (Optional) A Zend\Measure\Number Type
  178
+     * @param  string|\Zend\Locale\Locale $locale (Optional) A Zend\Locale\Locale Type
179 179
      * @throws Zend\Measure\Exception
180 180
      */
181 181
     public function setValue($value, $type = null, $locale = null)
6  library/Zend/Translator/Adapter/AbstractAdapter.php
@@ -264,7 +264,7 @@ public function addTranslation($options = array())
264 264
                 $originate = (string) $this->_options['locale'];
265 265
                 $options['locale'] = $options['content']->getLocale();
266 266
             }
267  
-        } catch (Locale\Exception $e) {
  267
+        } catch (Locale\Exception\ExceptionInterface $e) {
268 268
             throw new Exception\InvalidArgumentException("The given Language '{$options['locale']}' does not exist", 0, $e);
269 269
         }
270 270
 
@@ -502,7 +502,7 @@ public function setLocale($locale)
502 502
 
503 503
         try {
504 504
             $locale = Locale\Locale::findLocale($locale);
505  
-        } catch (Locale\Exception $e) {
  505
+        } catch (Locale\Exception\ExceptionInterface $e) {
506 506
             throw new Exception\InvalidArgumentException("The given Language ({$locale}) does not exist", 0, $e);
507 507
         }
508 508
 
@@ -691,7 +691,7 @@ private function _addTranslationData($options = array())
691 691
 
692 692
         try {
693 693
             $options['locale'] = Locale\Locale::findLocale($options['locale']);
694  
-        } catch (Locale\Exception $e) {
  694
+        } catch (Locale\Exception\ExceptionInterface $e) {
695 695
             throw new Exception\InvalidArgumentException("The given Language '{$options['locale']}' does not exist", 0, $e);
696 696
         }
697 697
 
4  library/Zend/Validator/Float.php
@@ -68,7 +68,7 @@ public function __construct($options = null)
68 68
     /**
69 69
      * Returns the set locale
70 70
      *
71  
-     * @return \Zend\Locale
  71
+     * @return \Zend\Locale\Locale
72 72
      */
73 73
     public function getLocale()
74 74
     {
@@ -109,7 +109,7 @@ public function isValid($value)
109 109
                 $this->error(self::NOT_FLOAT);
110 110
                 return false;
111 111
             }
112  
-        } catch (Locale\Exception $e) {
  112
+        } catch (Locale\Exception\ExceptionInterface $e) {
113 113
             $this->error(self::NOT_FLOAT);
114 114
             return false;
115 115
         }
6  library/Zend/Validator/PostCode.php
@@ -65,7 +65,7 @@ class PostCode extends AbstractValidator
65 65
      * Accepts either a string locale, a Zend_Locale object, or an array or
66 66
      * Zend_Config object containing the keys "locale" and/or "format".
67 67
      *
68  
-     * @param string|Zend_Locale|array|\Traversable $options
  68
+     * @param string|\Zend\Locale\Locale|array|\Traversable $options
69 69
      * @throws \Zend\Validator\Exception On empty format
70 70
      */
71 71
     public function __construct($options = null)
@@ -161,7 +161,7 @@ public function setFormat($format)
161 161
         $this->options['format'] = $format;
162 162
         return $this;
163 163
     }
164  
-    
  164
+
165 165
     /**
166 166
      * Returns the actual set service
167 167
      *
@@ -218,7 +218,7 @@ public function isValid($value)
218 218
                 return false;
219 219
             }
220 220
         }
221  
-        
  221
+
222 222
         $format = $this->getFormat();
223 223
         if (!preg_match($format, $value)) {
224 224
             $this->error(self::NO_MATCH);
2  library/Zend/View/Helper/Currency.php
@@ -61,7 +61,7 @@ public function __construct($currency = null)
61 61
      * Output a formatted currency
62 62
      *
63 63
      * @param  integer|float                    $value    Currency value to output
64  
-     * @param  string|Zend_Locale|\Zend\Currency\Currency $currency OPTIONAL Currency to use for this call
  64
+     * @param  string|\Zend\Locale\Locale|\Zend\Currency\Currency $currency OPTIONAL Currency to use for this call
65 65
      * @return string Formatted currency
66 66
      */
67 67
     public function __invoke($value = null, $currency = null)
10  tests/Zend/Date/DateObjectTest.php
@@ -25,8 +25,8 @@
25 25
     Zend\Date\DateObject,
26 26
     Zend\Cache\StorageFactory as CacheFactory,
27 27
     Zend\Cache\Storage\Adapter\AdapterInterface as CacheAdapter,
28  
-    Zend\Locale\Locale;
29  
-
  28
+    Zend\Locale\Locale,
  29
+    Zend\Locale\Exception\ExceptionInterface as LocaleException;
30 30
 /**
31 31
  * @category   Zend
32 32
  * @package    Zend_Date
@@ -67,7 +67,7 @@ public function testCreationNull()
67 67
         // look if locale is detectable
68 68
         try {
69 69
             $locale = new Locale();
70  
-        } catch (\Zend\Locale\Exception $e) {
  70
+        } catch (LocaleException $e) {
71 71
             $this->markTestSkipped('Autodetection of locale failed');
72 72
             return;
73 73
         }
@@ -84,7 +84,7 @@ public function testCreationNegative()
84 84
         // look if locale is detectable
85 85
         try {
86 86
             $locale = new Locale();
87  
-        } catch (\Zend\Locale\Exception $e) {
  87
+        } catch (LocaleException $e) {
88 88
             $this->markTestSkipped('Autodetection of locale failed');
89 89
             return;
90 90
         }
@@ -101,7 +101,7 @@ public function testCreationFailed()
101 101
         // look if locale is detectable
102 102
         try {
103 103
             $locale = new Locale();
104  
-        } catch (\Zend\Locale\Exception $e) {
  104
+        } catch (LocaleException $e) {
105 105
             $this->markTestSkipped('Autodetection of locale failed');
106 106
             return;
107 107
         }
13  tests/Zend/Date/DateTest.php
@@ -26,6 +26,7 @@
26 26
     Zend\Date\Date,
27 27
     Zend\Date\Cities,
28 28
     Zend\Locale\Locale,
  29
+    Zend\Locale\Exception\ExceptionInterface as LocaleException,
29 30
     Zend\TimeSync\TimeSync,
30 31
     Zend\Registry;
31 32
 
@@ -91,7 +92,7 @@ public function testCreation()
91 92
         // look if locale is detectable
92 93
         try {
93 94
             $locale = new Locale();
94  
-        } catch (\Zend\Locale\Exception $e) {
  95
+        } catch (LocaleException $e) {
95 96
             $this->markTestSkipped('Autodetection of locale failed');
96 97
             return;
97 98
         }
@@ -108,7 +109,7 @@ public function testCreationDefaultFormat()
108 109
         // look if locale is detectable
109 110
         try {
110 111
             $locale = new Locale();
111  
-        } catch (\Zend\Locale\Exception $e) {
  112
+        } catch (LocaleException $e) {
112 113
             $this->markTestSkipped('Autodetection of locale failed');
113 114
             return;
114 115
         }
@@ -130,7 +131,7 @@ public function testCreationDefaultFormatConsistency()
130 131
         // look if locale is detectable
131 132
         try {
132 133
             $locale = new Locale();
133  
-        } catch (\Zend\Locale\Exception $e) {
  134
+        } catch (LocaleException $e) {
134 135
             $this->markTestSkipped('Autodetection of locale failed');
135 136
             return;
136 137
         }
@@ -168,7 +169,7 @@ public function testCreationTimestamp()
168 169
         // look if locale is detectable
169 170
         try {
170 171
             $locale = new Locale();
171  
-        } catch (\Zend\Locale\Exception $e) {
  172
+        } catch (LocaleException $e) {
172 173
             $this->markTestSkipped('Autodetection of locale failed');
173 174
             return;
174 175
         }
@@ -185,7 +186,7 @@ public function testCreationDatePart()
185 186
         // look if locale is detectable
186 187
         try {
187 188
             $locale = new Locale();
188  
-        } catch (\Zend\Locale\Exception $e) {
  189
+        } catch (LocaleException $e) {
189 190
             $this->markTestSkipped('Autodetection of locale failed');
190 191
             return;
191 192
         }
@@ -225,7 +226,7 @@ public function testCreationDefaultLoose()
225 226
         // look if locale is detectable
226 227
         try {
227 228
             $locale = new Locale();
228  
-        } catch (\Zend\Locale\Exception $e) {
  229
+        } catch (LocaleException $e) {
229 230
             $this->markTestSkipped('Autodetection of locale failed');
230 231
             return;
231 232
         }
2  tests/Zend/Filter/AlnumTest.php
@@ -52,7 +52,7 @@ class AlnumTest extends \PHPUnit_Framework_TestCase
52 52
     /**
53 53
      * Locale in browser.
54 54
      *
55  
-     * @var Zend_Locale object
  55
+     * @var ZendLocale object
56 56
      */
57 57
     protected $_locale;
58 58
 
2  tests/Zend/Filter/AlphaTest.php
@@ -51,7 +51,7 @@ class AlphaTest extends \PHPUnit_Framework_TestCase
51 51
     /**
52 52
      * Locale in browser.
53 53
      *
54  
-     * @var Zend_Locale object
  54
+     * @var Locale object
55 55
      */
56 56
     protected $_locale;
57 57
 

0 notes on commit 0b5ff94

Please sign in to comment.
Something went wrong with that request. Please try again.