HasEntriesTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 6
c 1
b 0
f 1
dl 0
loc 29
ccs 6
cts 6
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A entry() 0 3 1
A getEntry() 0 7 2
1
<?php
2
3
namespace ByTIC\Assets\Assets\Traits;
4
5
use ByTIC\Assets\Assets\EntryPoint;
6
7
/**
8
 * Trait HasEntriesTrait
9
 * @package ByTIC\Assets\Assets\Traits
10
 */
11
trait HasEntriesTrait
12
{
13
    /**
14
     * All of the instantiated asset containers.
15
     *
16
     * @var array
17
     */
18
    protected $entries = [];
19
20
    /**
21
     * @param string $entry
22
     * @return EntryPoint
23
     */
24 1
    public static function entry(string $entry = '_default')
0 ignored issues
show
Unused Code introduced by
The parameter $entry is not used and could be removed. ( Ignorable by Annotation )

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

24
    public static function entry(/** @scrutinizer ignore-unused */ string $entry = '_default')

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
25
    {
26 1
        return static::instance()->getEntry();
27
    }
28
29
    /**
30
     * @param string $entry
31
     * @return EntryPoint
32
     */
33 1
    public function getEntry(string $entry = '_default')
34
    {
35 1
        if (!isset($this->entries[$entry])) {
36 1
            $this->entries[$entry] = new EntryPoint();
37
        }
38
39 1
        return $this->entries[$entry];
40
    }
41
}
42