Test Failed
Push — master ( fe7900...79d767 )
by Attila
11:12
created

HasDefaultConvention   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 11
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConvention() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Contains the HasDefaultConvention trait.
7
 *
8
 * @copyright   Copyright (c) 2021 Attila Fulop
9
 * @author      Attila Fulop
10
 * @license     MIT
11
 * @since       2021-11-13
12
 *
13
 */
14
15
namespace Konekt\Concord\Concerns;
16
17
use Konekt\Concord\Contracts\Convention;
18
use Konekt\Concord\Conventions\ConcordDefault;
19
20
trait HasDefaultConvention
21
{
22
    private static ?ConcordDefault $convention = null;
23
24
    public static function getConvention(): Convention
25
    {
26
        if (null === static::$convention) {
0 ignored issues
show
Bug introduced by
Since $convention is declared private, accessing it with static will lead to errors in possible sub-classes; you can either use self, or increase the visibility of $convention to at least protected.
Loading history...
27
            static::$convention = new ConcordDefault();
28
        }
29
30
        return static::$convention;
31
    }
32
}
33