Ver Fonte

[Translation] moved most protected methods and properties to private

Fabien Potencier há 14 anos atrás
pai
commit
75b29ffdfe

+ 1 - 1
src/Symfony/Component/Translation/IdentityTranslator.php

@@ -18,7 +18,7 @@ namespace Symfony\Component\Translation;
  */
 class IdentityTranslator implements TranslatorInterface
 {
-    protected $selector;
+    private $selector;
 
     /**
      * Constructor.

+ 1 - 1
src/Symfony/Component/Translation/Interval.php

@@ -90,7 +90,7 @@ class Interval
 EOF;
     }
 
-    static protected function convertNumber($number)
+    static private function convertNumber($number)
     {
         if ('-Inf' === $number) {
             return log(0);

+ 1 - 1
src/Symfony/Component/Translation/Loader/ArrayLoader.php

@@ -46,7 +46,7 @@ class ArrayLoader implements LoaderInterface
      * @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;

+ 2 - 2
src/Symfony/Component/Translation/Loader/XliffFileLoader.php

@@ -44,7 +44,7 @@ class XliffFileLoader implements LoaderInterface
      * @param  string $file
      * @return SimpleXMLElement
      */
-    protected function parseFile($file)
+    private function parseFile($file)
     {
         $dom = new \DOMDocument();
         $current = libxml_use_internal_errors(true);
@@ -74,7 +74,7 @@ class XliffFileLoader implements LoaderInterface
      *
      * @return array  An array of errors
      */
-    protected function getXmlErrors()
+    private function getXmlErrors()
     {
         $errors = array();
         foreach (libxml_get_errors() as $error) {

+ 3 - 3
src/Symfony/Component/Translation/MessageCatalogue.php

@@ -20,9 +20,9 @@ use Symfony\Component\Config\Resource\ResourceInterface;
  */
 class MessageCatalogue implements MessageCatalogueInterface
 {
-    protected $messages = array();
-    protected $locale;
-    protected $resources;
+    private $messages = array();
+    private $locale;
+    private $resources;
 
     /**
      * Constructor.

+ 1 - 1
src/Symfony/Component/Translation/PluralizationRules.php

@@ -19,7 +19,7 @@ namespace Symfony\Component\Translation;
 class PluralizationRules
 {
     // @codeCoverageIgnoreStart
-    static protected $rules = array();
+    static private $rules = array();
 
     /**
      * Returns the plural position to use for the given locale and number.

+ 8 - 9
src/Symfony/Component/Translation/Translator.php

@@ -20,12 +20,12 @@ use Symfony\Component\Translation\Loader\LoaderInterface;
  */
 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.
@@ -131,12 +131,11 @@ class Translator implements TranslatorInterface
         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]));
@@ -148,7 +147,7 @@ class Translator implements TranslatorInterface
         $this->optimizeCatalogue($locale);
     }
 
-    protected function optimizeCatalogue($locale)
+    private function optimizeCatalogue($locale)
     {
         if (strlen($locale) > 3) {
             $fallback = substr($locale, 0, -strlen(strrchr($locale, '_')));