| Server IP : 54.94.228.101 / Your IP : 172.28.20.13 Web Server : Apache System : Linux ip-172-28-29-189 6.5.0-1014-aws #14~22.04.1-Ubuntu SMP Thu Feb 15 15:27:06 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.2.34-43+ubuntu22.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/vinumday2_0/vendor/laravel/framework/src/Illuminate/Translation/ |
Upload File : |
<?php
namespace Illuminate\Translation;
use Illuminate\Filesystem\Filesystem;
class FileLoader implements LoaderInterface
{
/**
* The filesystem instance.
*
* @var \Illuminate\Filesystem\Filesystem
*/
protected $files;
/**
* The default path for the loader.
*
* @var string
*/
protected $path;
/**
* All of the namespace hints.
*
* @var array
*/
protected $hints = [];
/**
* Create a new file loader instance.
*
* @param \Illuminate\Filesystem\Filesystem $files
* @param string $path
* @return void
*/
public function __construct(Filesystem $files, $path)
{
$this->path = $path;
$this->files = $files;
}
/**
* Load the messages for the given locale.
*
* @param string $locale
* @param string $group
* @param string $namespace
* @return array
*/
public function load($locale, $group, $namespace = null)
{
if ($group == '*' && $namespace == '*') {
return $this->loadJsonPath($this->path, $locale);
}
if (is_null($namespace) || $namespace == '*') {
return $this->loadPath($this->path, $locale, $group);
}
return $this->loadNamespaced($locale, $group, $namespace);
}
/**
* Load a namespaced translation group.
*
* @param string $locale
* @param string $group
* @param string $namespace
* @return array
*/
protected function loadNamespaced($locale, $group, $namespace)
{
if (isset($this->hints[$namespace])) {
$lines = $this->loadPath($this->hints[$namespace], $locale, $group);
return $this->loadNamespaceOverrides($lines, $locale, $group, $namespace);
}
return [];
}
/**
* Load a local namespaced translation group for overrides.
*
* @param array $lines
* @param string $locale
* @param string $group
* @param string $namespace
* @return array
*/
protected function loadNamespaceOverrides(array $lines, $locale, $group, $namespace)
{
$file = "{$this->path}/vendor/{$namespace}/{$locale}/{$group}.php";
if ($this->files->exists($file)) {
return array_replace_recursive($lines, $this->files->getRequire($file));
}
return $lines;
}
/**
* Load a locale from a given path.
*
* @param string $path
* @param string $locale
* @param string $group
* @return array
*/
protected function loadPath($path, $locale, $group)
{
if ($this->files->exists($full = "{$path}/{$locale}/{$group}.php")) {
return $this->files->getRequire($full);
}
return [];
}
/**
* Load a locale from the given JSON file path.
*
* @param string $path
* @param string $locale
* @return array
*/
protected function loadJsonPath($path, $locale)
{
if ($this->files->exists($full = "{$path}/{$locale}.json")) {
return json_decode($this->files->get($full), true);
}
return [];
}
/**
* Add a new namespace to the loader.
*
* @param string $namespace
* @param string $hint
* @return void
*/
public function addNamespace($namespace, $hint)
{
$this->hints[$namespace] = $hint;
}
/**
* Get an array of all the registered namespaces.
*
* @return array
*/
public function namespaces()
{
return $this->hints;
}
}