<?php
namespace Cubist\Locale;
+
use \RecursiveIteratorIterator;
use \RecursiveDirectoryIterator;
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)
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()
public static function extractTextsToTranslate(SplFileInfo $file)
{
- $toTranslate = array();
+ $toTranslate = [];
if (!$file->isFile() || !$file->isReadable()) {
- $toTranslate = array();
+ $toTranslate = [];
} else {
$c = file_get_contents($file);