Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Gets the current working directory
<?php getcwd(): string|false
<?php protected function existingLanguages()
{
return collect($this->files->directories(getcwd().'/resources/lang'))
->map(function ($dir) {
return basename($dir);
})
<?php protected function reviewStringFile($lang)
{
$path = "resources/lang/$lang.json";
$fullPath = getcwd().'/'.$path;
throw_if(! $this->files->exists($fullPath), new \Exception("$path does not exist."));
<?php protected function reviewKeyFile($lang, $file)
{
$path = "resources/lang/$lang/$file.php";
$fullPath = getcwd().'/'.$path;
throw_if(! $this->files->exists($fullPath), new \Exception("$path does not exist."));
<?php return $cached;
}
$path = getcwd()."/resources/lang/en/{$file}.php";
return $this->englishTranslations[$file] = require $path;
}
<?php protected function discover()
{
$dir = getcwd();
$paths = [$dir.'/src', $dir.'/resources'];
$discovery = new MethodDiscovery(new Filesystem, $paths);
<?php protected function translateStringFile($lang)
{
$path = "resources/lang/{$lang}.json";
$fullPath = getcwd().'/'.$path;
if (! $this->files->exists($fullPath)) {
return;
}
<?php protected function translateKeyFiles($lang)
{
collect($this->files->files(getcwd().'/resources/lang/'.$lang))
->filter(function ($file) {
$filename = substr($file->getBasename(), 0, -4); // without extension
<?php return $cached;
}
$path = getcwd()."/resources/lang/en/{$file}.php";
return $this->englishTranslations[$file] = require $path;
}
<?php protected function existingLanguages()
{
return collect($this->files->directories(getcwd().'/resources/lang'))
->map(function ($dir) {
return basename($dir);
})