Definition at line 9 of file Extractor.php.
◆ fromFile()
static Gettext\Extractors\Extractor::fromFile |
( |
|
$file, |
|
|
Translations |
$translations = null |
|
) |
| |
|
static |
Extract the translations from a file.
- Parameters
-
array | string | $file | A path of a file or files |
null | Translations | $translations | The translations instance to append the new translations. |
- Returns
- Translations
Definition at line 19 of file Extractor.php.
21 if ($translations === null) {
22 $translations =
new Translations();
25 foreach (self::getFiles($file) as $file) {
26 static::fromString(self::readFile($file), $translations, $file);
◆ getFiles()
static Gettext\Extractors\Extractor::getFiles |
( |
|
$file | ) |
|
|
staticprotected |
Checks and returns all files.
- Parameters
-
string | array | $file | The file/s |
- Returns
- array The file paths
Definition at line 39 of file Extractor.php.
References $f, and $files.
45 if (is_string($file)) {
46 if (!is_file($file)) {
50 if (!is_readable($file)) {
57 if (is_array($file)) {
60 foreach ($file as
$f) {
◆ readFile()
static Gettext\Extractors\Extractor::readFile |
( |
|
$file | ) |
|
|
staticprotected |
Reads and returns the content of a file.
- Parameters
-
- Returns
- string
Definition at line 77 of file Extractor.php.
79 $length = filesize($file);
81 if (!($fd =
fopen($file,
'rb'))) {
82 throw new Exception(
"Cannot read the file '$file', probably permissions");
85 $content = $length ? fread($fd, $length) :
'';
The documentation for this class was generated from the following file:
- libs/composer/vendor/gettext/gettext/src/Extractors/Extractor.php