model::get_service()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 2
c 0
b 0
f 0
rs 10
cc 2
nc 2
nop 1
1
<?php
2
3
/**
4
 * © 2018 - Phoponent
5
 * Author: Nicolas Choquet
6
 * Email: [email protected]
7
 * LICENSE GPL ( GNU General Public License )
8
 */
9
10
namespace phoponent\framework\traits;
11
12
trait model {
13
	private $services = [];
14
	private $component = '';
15
    public function __construct($services, string $component) {
16
        $this->services = $services;
17
		$this->component = $component;
18
    }
19
20
    protected function get_services() {
21
    	return $this->services;
22
	}
23
24
	/**
25
	 * @param $name
26
	 * @return service|null
27
	 */
28
	protected function get_service($name) {
29
    	return isset($this->services[$name]) ? $this->services[$name] : null;
30
	}
31
32
	public function get_component() {
33
		return $this->component;
34
	}
35
}