Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Intl] Improved bundle reader implementations
- Loading branch information
Showing
25 changed files
with
573 additions
and
253 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
src/Symfony/Component/Intl/Exception/MissingResourceException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Intl\Exception; | ||
|
||
/** | ||
* Thrown when an invalid entry of a resource bundle was requested. | ||
* | ||
* @author Bernhard Schussek <bschussek@gmail.com> | ||
*/ | ||
class MissingResourceException extends RuntimeException | ||
{ | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Symfony/Component/Intl/Exception/ResourceBundleNotFoundException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Intl\Exception; | ||
|
||
/** | ||
* @author Bernhard Schussek <bschussek@gmail.com> | ||
*/ | ||
class ResourceBundleNotFoundException extends RuntimeException | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Intl; | ||
|
||
/** | ||
* Provides access to locale-related data. | ||
* | ||
* @author Bernhard Schussek <bschussek@gmail.com> | ||
* | ||
* @internal | ||
*/ | ||
final class Locale extends \Locale | ||
{ | ||
/** | ||
* Returns the fallback locale for a given locale, if any | ||
* | ||
* @param string $locale The ICU locale code to find the fallback for. | ||
* | ||
* @return string|null The ICU locale code of the fallback locale, or null | ||
* if no fallback exists | ||
*/ | ||
public static function getFallback($locale) | ||
{ | ||
if (false === $pos = strrpos($locale, '_')) { | ||
if ('root' === $locale) { | ||
return; | ||
} | ||
|
||
return 'root'; | ||
} | ||
|
||
return substr($locale, 0, $pos); | ||
} | ||
|
||
/** | ||
* This class must not be instantiated. | ||
*/ | ||
private function __construct() {} | ||
} |
44 changes: 0 additions & 44 deletions
44
src/Symfony/Component/Intl/ResourceBundle/Reader/AbstractBundleReader.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.