Don't use the Config facade in the TimezoneLocaleComposer

This commit is contained in:
James Brooks
2016-07-13 14:35:49 +01:00
parent 503252c3a2
commit 895d1ea1b6
+21 -2
View File
@@ -13,11 +13,30 @@ namespace CachetHQ\Cachet\Composers;
use DateTime; use DateTime;
use DateTimeZone; use DateTimeZone;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Contracts\View\View; use Illuminate\Contracts\View\View;
use Illuminate\Support\Facades\Config;
class TimezoneLocaleComposer class TimezoneLocaleComposer
{ {
/**
* The illuminate config instance.
*
* @var \Illuminate\Contracts\Config\Repository
*/
protected $config;
/**
* Create a new timezone locale composer.
*
* @param \Illuminate\Contracts\Config\Repository $config
*
* @return void
*/
public function __construct(Repository $config)
{
$this->config = $config;
}
/** /**
* Timezones and Locales composer. * Timezones and Locales composer.
* *
@@ -27,7 +46,7 @@ class TimezoneLocaleComposer
*/ */
public function compose(View $view) public function compose(View $view)
{ {
$enabledLangs = Config::get('langs'); $enabledLangs = $this->config->get('langs');
$langs = array_map(function ($lang) use ($enabledLangs) { $langs = array_map(function ($lang) use ($enabledLangs) {
$locale = basename($lang); $locale = basename($lang);