1
0
mirror of https://github.com/flarum/core.git synced 2025-08-15 04:44:08 +02:00

Use Laravel's class-based Str and Arr helpers

Starting with version 5.9, the global funtions will be deprecated.

* https://laravel-news.com/laravel-5-8-deprecates-string-and-array-helpers
* https://github.com/laravel/framework/pull/26898
This commit is contained in:
Franz Liedke
2019-07-06 00:49:34 +02:00
parent 307b912019
commit 646bd40bca
78 changed files with 229 additions and 144 deletions

View File

@@ -11,6 +11,8 @@
namespace Flarum\Locale;
use Illuminate\Support\Arr;
class LocaleManager
{
/**
@@ -74,12 +76,12 @@ class LocaleManager
public function getJsFiles(string $locale): array
{
$files = array_get($this->js, $locale, []);
$files = Arr::get($this->js, $locale, []);
$parts = explode('-', $locale);
if (count($parts) > 1) {
$files = array_merge(array_get($this->js, $parts[0], []), $files);
$files = array_merge(Arr::get($this->js, $parts[0], []), $files);
}
return $files;
@@ -92,12 +94,12 @@ class LocaleManager
public function getCssFiles(string $locale): array
{
$files = array_get($this->css, $locale, []);
$files = Arr::get($this->css, $locale, []);
$parts = explode('-', $locale);
if (count($parts) > 1) {
$files = array_merge(array_get($this->css, $parts[0], []), $files);
$files = array_merge(Arr::get($this->css, $parts[0], []), $files);
}
return $files;