Passed
Push — master ( c1fc2f...23f085 )
by Mihail
04:43
created

Controller   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 4
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A loadAppsTable() 0 9 2
1
<?php
2
3
namespace Extend\Core\Arch;
4
5
use Ffcms\Core\App;
6
use Apps\ActiveRecord\App as AppRecord;
7
use Ffcms\Core\Arch\Controller as AbstractController;
8
9
class Controller extends AbstractController
10
{
11
    protected $table;
12
13
    public function __construct()
14
    {
15
        $this->loadAppsTable();
16
        parent::__construct();
17
    }
18
19
    /**
20
     * Load application table in memory & cache. All applications as object is available in $this->apps
21
     */
22
    private function loadAppsTable()
23
    {
24
        if (App::$Memory->get('table.apps') !== null) {
25
            $this->table = App::$Memory->get('table.apps');
26
        } else {
27
            $this->table = AppRecord::all();
28
            App::$Memory->set('table.apps', $this->table);
29
        }
30
    }
31
32
}