PagesRepository   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 45
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getModel() 0 4 1
A getHeader() 0 8 1
A getFooter() 0 7 1
A getPagesHelp() 0 8 1
1
<?php
2
3
namespace App\Repositories;
4
5
use App\Page;
6
7
class PagesRepository extends Repository
8
{
9
    public function getModel()
10
    {
11
        return new Page();
12
    }
13
14
    /**
15
     * Get pages for footer.
16
     * Max number of pages is 2 at moment.
17
     *
18
     * @return mixed
19
     */
20
    public function getHeader($count = 1)
21
    {
22
        return self::getModel()
0 ignored issues
show
Documentation Bug introduced by
The method where does not exist on object<App\Page>? 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...
23
            ->where('show_in_header', 1)
24
            ->active()
25
            ->take($count)
26
            ->get();
27
    }
28
29
    /**
30
     * Get pages for footer.
31
     *
32
     * @return mixed
33
     */
34
    public function getFooter()
35
    {
36
        return self::getModel()
0 ignored issues
show
Documentation Bug introduced by
The method where does not exist on object<App\Page>? 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...
37
            ->where('show_in_footer', 1)
38
            ->active()
39
            ->get();
40
    }
41
42
43
    public function getPagesHelp()
44
    {
45
        return self::getModel()
0 ignored issues
show
Documentation Bug introduced by
The method where does not exist on object<App\Page>? 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...
46
            ->where('page_type', '!=', null)
47
            ->orderBy('page_type',self::ASC)
48
            ->active()
49
            ->get();
50
    }
51
}