Navigation Menu

Skip to content

Commit

Permalink
[Translation] moved most protected methods and properties to private
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Mar 8, 2011
1 parent 94c4459 commit 75b29ff
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Translation/IdentityTranslator.php
Expand Up @@ -18,7 +18,7 @@
*/
class IdentityTranslator implements TranslatorInterface
{
protected $selector;
private $selector;

/**
* Constructor.
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Translation/Interval.php
Expand Up @@ -90,7 +90,7 @@ static public function getIntervalRegexp()
EOF;
}

static protected function convertNumber($number)
static private function convertNumber($number)
{
if ('-Inf' === $number) {
return log(0);
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Translation/Loader/ArrayLoader.php
Expand Up @@ -46,7 +46,7 @@ public function load($resource, $locale, $domain = 'messages')
* @param array $subnode current subnode being parsed, used internally for recursive calls
* @param string $path current path being parsed, used internally for recursive calls
*/
protected function flatten(array &$messages, array $subnode = null, $path = null)
private function flatten(array &$messages, array $subnode = null, $path = null)
{
if (null === $subnode) {
$subnode =& $messages;
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Translation/Loader/XliffFileLoader.php
Expand Up @@ -44,7 +44,7 @@ public function load($resource, $locale, $domain = 'messages')
* @param string $file
* @return SimpleXMLElement
*/
protected function parseFile($file)
private function parseFile($file)
{
$dom = new \DOMDocument();
$current = libxml_use_internal_errors(true);
Expand Down Expand Up @@ -74,7 +74,7 @@ protected function parseFile($file)
*
* @return array An array of errors
*/
protected function getXmlErrors()
private function getXmlErrors()
{
$errors = array();
foreach (libxml_get_errors() as $error) {
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/Translation/MessageCatalogue.php
Expand Up @@ -20,9 +20,9 @@
*/
class MessageCatalogue implements MessageCatalogueInterface
{
protected $messages = array();
protected $locale;
protected $resources;
private $messages = array();
private $locale;
private $resources;

/**
* Constructor.
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Translation/PluralizationRules.php
Expand Up @@ -19,7 +19,7 @@
class PluralizationRules
{
// @codeCoverageIgnoreStart
static protected $rules = array();
static private $rules = array();

/**
* Returns the plural position to use for the given locale and number.
Expand Down
17 changes: 8 additions & 9 deletions src/Symfony/Component/Translation/Translator.php
Expand Up @@ -20,12 +20,12 @@
*/
class Translator implements TranslatorInterface
{
protected $catalogues;
protected $locale;
protected $fallbackLocale;
protected $loaders;
protected $resources;
protected $selector;
private $catalogues;
private $locale;
private $fallbackLocale;
private $loaders;
private $resources;
private $selector;

/**
* Constructor.
Expand Down Expand Up @@ -131,12 +131,11 @@ public function transChoice($id, $number, array $parameters = array(), $domain =
return strtr($this->selector->choose($this->catalogues[$locale]->get($id, $domain), (int) $number, $locale), $parameters);
}

protected function loadCatalogue($locale)
private function loadCatalogue($locale)
{
$this->catalogues[$locale] = new MessageCatalogue($locale);

if (isset($this->resources[$locale])) {

foreach ($this->resources[$locale] as $resource) {
if (!isset($this->loaders[$resource[0]])) {
throw new \RuntimeException(sprintf('The "%s" translation loader is not registered.', $resource[0]));
Expand All @@ -148,7 +147,7 @@ protected function loadCatalogue($locale)
$this->optimizeCatalogue($locale);
}

protected function optimizeCatalogue($locale)
private function optimizeCatalogue($locale)
{
if (strlen($locale) > 3) {
$fallback = substr($locale, 0, -strlen(strrchr($locale, '_')));
Expand Down

0 comments on commit 75b29ff

Please sign in to comment.