Completed
Push — development ( 9a019e...1dec28 )
by Alexander
03:32
created

EnvironmentTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 29
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setEnvironment() 0 6 1
A getEnvironment() 0 4 1
1
<?php
2
/**
3
 * Trait for handling Environment object
4
 *
5
 * @file      EnvironmentTrait.php
6
 *
7
 * PHP version 5.6+
8
 *
9
 * @author    Yancharuk Alexander <alex at itvault dot info>
10
 * @copyright © 2012-2016 Alexander Yancharuk <alex at itvault at info>
11
 * @date      2016-11-05 09:57
12
 * @license   The BSD 3-Clause License
13
 *            <https://tldrlegal.com/license/bsd-3-clause-license-(revised)>
14
 */
15
16
namespace Veles\Application;
17
18
trait EnvironmentTrait
19
{
20
	/** @var  Environment */
21
	protected $environment;
22
23
	/**
24
	 * Set application environment
25
	 *
26
	 * @param Environment $environment
27
	 *
28
	 * @return EnvironmentTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EnvironmentTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
29
	 */
30
	public function setEnvironment(Environment $environment)
31
	{
32
		$this->environment = $environment;
33
34
		return $this;
35
	}
36
37
	/**
38
	 * Get environment object
39
	 *
40
	 * @return Environment
41
	 */
42
	public function getEnvironment()
43
	{
44
		return $this->environment;
45
	}
46
}
47