ReadsManifestFile   A
last analyzed

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 manifest() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Contains the ReadsManifestFile trait.
7
 *
8
 * @copyright   Copyright (c) 2021 Attila Fulop
9
 * @author      Attila Fulop
10
 * @license     MIT
11
 * @since       2021-11-18
12
 *
13
 */
14
15
namespace Konekt\Concord\Concerns;
16
17
use Konekt\Concord\Contracts\Convention;
18
use Konekt\Concord\Module\ManifestFile;
19
20
trait ReadsManifestFile
21
{
22
    private ?ManifestFile $manifestFile = null;
23
24
    protected function manifest(Convention $convention): ManifestFile
25
    {
26
        if (null === $this->manifestFile) {
27
            $this->manifestFile = ManifestFile::read($this->getBasePath() . '/' . $convention->manifestFile());
0 ignored issues
show
Bug introduced by
It seems like getBasePath() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

27
            $this->manifestFile = ManifestFile::read($this->/** @scrutinizer ignore-call */ getBasePath() . '/' . $convention->manifestFile());
Loading history...
28
        }
29
30
        return $this->manifestFile;
31
    }
32
}
33