TranslateRepository   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 26
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getModel() 0 4 1
A getTanslateModel() 0 4 1
A getKey() 0 7 1
1
<?php
2
3
namespace App\Repositories;
4
5
use App\TranslateTransaltions;
6
use App\Translate;
7
8
class TranslateRepository extends Repository
9
{
10
    /**
11
     * @return Translate
12
     */
13
    public function getModel()
14
    {
15
        return new Translate();
16
    }
17
18
    public function getTanslateModel()
19
    {
20
        return new TranslateTransaltions();
21
    }
22
23
    /**
24
     * @return mixed
25
     */
26
    public function getKey($key)
27
    {
28
        return self::getModel()
0 ignored issues
show
Documentation Bug introduced by
The method where does not exist on object<App\Translate>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
29
            ->where('key', $key)
30
            ->active()
31
            ->first();
32
    }
33
}