Locale::current()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace Locale\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\Relations\Pivot;
7
use Illuminate\Database\Query\Builder;
8
9
/**
10
 * Class Locale
11
 *
12
 * @since 1.0.0
13
 * @package Locale\Models
14
 *
15
 * @method static Builder create(array $attributes)
16
 * @method static Locale find(string $id)
17
 * @method static Builder whereKey(string $id)
18
 *
19
 * @property integer id
20
 * @property string name
21
 * @property Pivot translation
22
 */
23
class Locale extends Model
24
{
25
    /**
26
     * The "type" of the auto-incrementing ID.
27
     *
28
     * @var string
29
     */
30
    protected $keyType = 'string';
31
32
    /**
33
     * Indicates if the IDs are auto-incrementing.
34
     *
35
     * @var bool
36
     */
37
    public $incrementing = false;
38
39
    /**
40
     * The attributes that aren't mass assignable.
41
     *
42
     * @since 1.0.0
43
     * @var array
44
     */
45
    protected $guarded = [];
46
47
    /**
48
     * @since 1.0.0
49
     * @return Locale
50
     */
51
    public static function current()
52
    {
53
        return Locale::find(app()->getLocale());
0 ignored issues
show
introduced by
The method getLocale() does not exist on Illuminate\Container\Container. Are you sure you never get this type here, but always one of the subclasses? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

53
        return Locale::find(app()->/** @scrutinizer ignore-call */ getLocale());
Loading history...
54
    }
55
}
56