RepositoriesTrait   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
eloc 8
c 1
b 0
f 1
dl 0
loc 21
rs 10
ccs 5
cts 10
cp 0.5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A registerRepositories() 0 5 2
A appendRepositoriesToProvide() 0 7 2
1
<?php
2
3
namespace ByTIC\Hello\Oauth\ServiceProvider\Traits;
4
5
use ByTIC\Hello\Utility\ModelsHelper;
6
7
/**
8
 * Trait RepositoriesTrait
9
 * @package ByTIC\Hello\Oauth\ServiceProvider\Traits
10
 */
11
trait RepositoriesTrait
12
{
13 1
    public function registerRepositories()
14
    {
15 1
        $repositories = ModelsHelper::repositories();
16 1
        foreach ($repositories as $interface => $class) {
17 1
            $this->getContainer()->alias($class, $interface);
0 ignored issues
show
Bug introduced by
It seems like getContainer() 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

17
            $this->/** @scrutinizer ignore-call */ 
18
                   getContainer()->alias($class, $interface);
Loading history...
18
        }
19 1
    }
20
21
    /**
22
     * @param $return
23
     * @return array
24
     */
25
    protected function appendRepositoriesToProvide($return)
26
    {
27
        $repositories = ModelsHelper::repositories();
28
        foreach ($repositories as $interface => $class) {
29
            $return[] = $interface;
30
        }
31
        return $return;
32
    }
33
}
34