Controller   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A loadAppsTable() 0 7 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