Remove deprecated global helper functions (issue #99)

Squashed commit of the following:

commit 8ff29a8ab51ee5057ef786614ab95b005bf8918c
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Fri Feb 1 18:42:05 2019 +0000

    Replace deprecated global helpers with their facade equivalents
This commit is contained in:
Jonny Barnes 2019-02-01 18:49:35 +00:00
parent 7a4ba43b4d
commit fb44afd7ad
15 changed files with 104 additions and 90 deletions

View file

@ -6,6 +6,7 @@ namespace App\Models;
use Mf2;
use App\Traits\FilterHtml;
use Illuminate\Support\Arr;
use Illuminate\Database\Eloquent\Model;
class Like extends Model
@ -48,7 +49,7 @@ class Like extends Model
$mf2 = Mf2\parse($value, $this->url);
if (array_get($mf2, 'items.0.properties.content.0.html')) {
if (Arr::get($mf2, 'items.0.properties.content.0.html')) {
return $this->filterHtml(
$mf2['items'][0]['properties']['content'][0]['html']
);

View file

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Models;
use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
@ -40,7 +41,7 @@ class Media extends Model
*/
public function getUrlAttribute(): string
{
if (starts_with($this->path, 'https://')) {
if (Str::startsWith($this->path, 'https://')) {
return $this->path;
}

View file

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Models;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
@ -171,10 +172,10 @@ class Place extends Model
private function getType(string $url): string
{
$host = parse_url($url, PHP_URL_HOST);
if (ends_with($host, 'foursquare.com') === true) {
if (Str::endsWith($host, 'foursquare.com') === true) {
return 'foursquare';
}
if (ends_with($host, 'openstreetmap.org') === true) {
if (Str::endsWith($host, 'openstreetmap.org') === true) {
return 'osm';
}