RepositoriesTrait::appendRepositoriesToProvide()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
c 1
b 0
f 1
dl 0
loc 7
rs 10
ccs 0
cts 5
cp 0
cc 2
nc 2
nop 1
crap 6
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