Passed
Pull Request — dev (#45)
by Stone
04:22 queued 02:13
created

IncludesModel   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getMenu() 0 11 2
A getJumbotron() 0 4 1
1
<?php
2
3
namespace App\Models;
4
5
use Core\Model;
6
7
/**
8
 * Class IncludesModel
9
 * All the included views data (menu, jumbotron, ...)
10
 * the returned data should then be stored in a $data['var'] and the view will check if var is set
11
 * @package App\Models
12
 */
13
class IncludesModel extends Model
14
{
15
    /**
16
     * get all the menu elements from the database
17
     * @return array the categories and access URL
18
     * @throws \ReflectionException
19
     */
20
    public function getMenu():array
21
    {
22
        $data = [];
23
        //get the categories from database
24
        $categories = $this->getResultSet('categories');
25
        foreach ( $categories as $category) {
26
            $data +=[
27
                $category->category_name => '/category/'.$category->categories_slug
28
            ];
29
        }
30
        return $data;
31
    }
32
33
    /**
34
     * Gets the Jumbotron elements
35
     * @return array
36
     */
37
    public function getJumbotron(): array
38
    {
39
        $data = [];
40
        return $data;
41
    }
42
43
}