Completed
Push — master ( 28f29f...4081af )
by Adam
08:00 queued 05:40
created

Configuration::useLazyAssociation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 1
cts 1
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Configuration.php
4
 *
5
 * @copyright      More in license.md
6
 * @license        http://www.ipublikuj.eu
7
 * @author         Adam Kadlec http://www.ipublikuj.eu
8
 * @package        iPublikuj:DoctrineBlameable!
9
 * @subpackage     common
10
 * @since          1.0.0
11
 *
12
 * @date           02.01.16
13
 */
14
15
declare(strict_types = 1);
16
17
namespace IPub\DoctrineBlameable;
18
19
use Nette;
20
use Nette\Http;
21
22
/**
23
 * Doctrine blameable extension configuration storage
24
 * Store basic extension settings
25
 *
26
 * @package        iPublikuj:DoctrineBlameable!
27
 * @subpackage     common
28
 *
29
 * @author         Adam Kadlec <[email protected]>
30
 */
31 1
final class Configuration extends Nette\Object
32
{
33
	/**
34
	 * Flag if use lazy association or not
35
	 *
36
	 * @var bool
37
	 */
38
	public $lazyAssociation = FALSE;
39
40
	/**
41
	 * User entity name
42
	 *
43
	 * @var string|NULL
44
	 */
45
	public $userEntity;
46
47
	/**
48
	 * Automatically map filed if not set
49
	 *
50
	 * @var bool
51
	 */
52
	public $automapField = TRUE;
53
54
	/**
55
	 * @param string|NULL $userEntity
56
	 * @param bool $lazyAssociation
57
	 * @param bool $automapField
58
	 */
59
	public function __construct(string $userEntity = NULL, bool $lazyAssociation = FALSE, bool $automapField = FALSE)
60
	{
61 1
		$this->userEntity = $userEntity;
62 1
		$this->lazyAssociation = $lazyAssociation;
63 1
		$this->automapField = $automapField;
64 1
	}
65
66
	/**
67
	 * @return bool
68
	 */
69 View Code Duplication
	public function automapWithAssociation() : bool
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
70
	{
71 1
		if ($this->userEntity !== NULL && class_exists($this->userEntity) && $this->automapField === TRUE) {
72 1
			return TRUE;
73
		}
74
75 1
		return FALSE;
76
	}
77
78
	/**
79
	 * @return bool
80
	 */
81 View Code Duplication
	public function automapWithField() : bool
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
82
	{
83 1
		if ($this->userEntity === NULL && $this->automapField === TRUE) {
84 1
			return TRUE;
85
		}
86
87
		return FALSE;
88
	}
89
90
	/**
91
	 * @return bool
92
	 */
93
	public function useLazyAssociation() : bool
94
	{
95 1
		return $this->lazyAssociation === TRUE;
96
	}
97
}
98