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

IncludesModel::getJumbotron()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
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
}