]> _ Git - cubist_locale.git/commitdiff
wip #4623 @0:15
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 27 Jul 2021 08:17:42 +0000 (10:17 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 27 Jul 2021 08:17:42 +0000 (10:17 +0200)
src/Translate.php

index 5da4670315bd4f46f360fee850663deedc0f5e9a..b3ed68bacd48d645b5c4e8bdc945021c7336eb29 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 namespace Cubist\Locale;
+
 use \RecursiveIteratorIterator;
 use \RecursiveDirectoryIterator;
 use \SplFileInfo;
@@ -8,14 +9,13 @@ use \SplFileInfo;
 class Translate
 {
 
-    protected $_paths = array();
-    protected $_extensions = array();
-    protected $_toTranslate = array();
+    protected $_paths = [];
+    protected $_extensions = ['php', 'phtml'];
+    protected $_toTranslate = [];
 
     public function __construct()
     {
-        $this->addExtension('php');
-        $this->addExtension('phtml');
+
     }
 
     public function addPath($path)
@@ -25,13 +25,18 @@ class Translate
 
     public function clearPaths()
     {
-        $this->_paths = array();
-        $this->_toTranslate = array();
+        $this->_paths = [];
+        $this->_toTranslate = [];
+    }
+
+    public function setExtensions(array $extensions)
+    {
+        $this->_extensions = $extensions;
     }
 
-    public function addExtension($ext)
+    public function addExtension($extension)
     {
-        $this->_extensions[] = $ext;
+        $this->_extensions[] = $extension;
     }
 
     public function parseFiles()
@@ -60,10 +65,10 @@ class Translate
 
     public static function extractTextsToTranslate(SplFileInfo $file)
     {
-        $toTranslate = array();
+        $toTranslate = [];
 
         if (!$file->isFile() || !$file->isReadable()) {
-            $toTranslate = array();
+            $toTranslate = [];
         } else {
             $c = file_get_contents($file);