mirror of
https://github.com/flarum/core.git
synced 2025-08-01 06:00:24 +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:
@@ -13,6 +13,7 @@ namespace Flarum\Foundation;
|
||||
|
||||
use Flarum\Foundation\Event\Validating;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Validation\Factory;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
@@ -89,7 +90,7 @@ abstract class AbstractValidator
|
||||
*/
|
||||
protected function makeValidator(array $attributes)
|
||||
{
|
||||
$rules = array_only($this->getRules(), array_keys($attributes));
|
||||
$rules = Arr::only($this->getRules(), array_keys($attributes));
|
||||
|
||||
$validator = $this->validator->make($attributes, $rules, $this->getMessages());
|
||||
|
||||
|
@@ -127,7 +127,7 @@ class Application extends Container implements ApplicationContract
|
||||
*/
|
||||
public function config($key, $default = null)
|
||||
{
|
||||
return array_get($this->make('flarum.config'), $key, $default);
|
||||
return Arr::get($this->make('flarum.config'), $key, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,7 +149,7 @@ class Application extends Container implements ApplicationContract
|
||||
public function url($path = null)
|
||||
{
|
||||
$config = $this->make('flarum.config');
|
||||
$url = array_get($config, 'url', array_get($_SERVER, 'REQUEST_URI'));
|
||||
$url = Arr::get($config, 'url', Arr::get($_SERVER, 'REQUEST_URI'));
|
||||
|
||||
if (is_array($url)) {
|
||||
if (isset($url[$path])) {
|
||||
@@ -160,7 +160,7 @@ class Application extends Container implements ApplicationContract
|
||||
}
|
||||
|
||||
if ($path) {
|
||||
$url .= '/'.array_get($config, "paths.$path", $path);
|
||||
$url .= '/'.Arr::get($config, "paths.$path", $path);
|
||||
}
|
||||
|
||||
return $url;
|
||||
|
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Flarum\Foundation;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
@@ -38,7 +39,7 @@ class MaintenanceModeHandler implements RequestHandlerInterface
|
||||
|
||||
private function isApiRequest(ServerRequestInterface $request): bool
|
||||
{
|
||||
return str_contains(
|
||||
return Str::contains(
|
||||
$request->getHeaderLine('Accept'),
|
||||
'application/vnd.api+json'
|
||||
);
|
||||
|
Reference in New Issue
Block a user