1: <?php
2: /**
3: * PHP version 5
4: * @package generalDriver
5: * @author Christian Schiffler <c.schiffler@cyberspectrum.de>
6: * @author Stefan Heimes <stefan_heimes@hotmail.com>
7: * @author Tristan Lins <tristan.lins@bit3.de>
8: * @copyright The MetaModels team.
9: * @license LGPL.
10: * @filesource
11: */
12:
13: namespace DcGeneral\DataDefinition\Palette\Condition\Property;
14:
15: use DcGeneral\Data\ModelInterface;
16: use DcGeneral\Data\PropertyValueBag;
17:
18: /**
19: * Condition for specifying an explicit boolean value (Useful for determining if a property shall be editable i.e.).
20: */
21: class BooleanCondition implements PropertyConditionInterface
22: {
23: /**
24: * The boolean value to return.
25: *
26: * @var bool
27: */
28: protected $value;
29:
30: /**
31: * Create a new instance.
32: *
33: * @param bool $value The value to use.
34: */
35: public function __construct($value)
36: {
37: $this->value = (bool)$value;
38: }
39:
40: /**
41: * Set the value.
42: *
43: * @param bool $value The value to use.
44: *
45: * @return BooleanCondition
46: */
47: public function setValue($value)
48: {
49: $this->value = (bool)$value;
50:
51: return $this;
52: }
53:
54: /**
55: * Retrieve the value.
56: *
57: * @return bool
58: */
59: public function getValue()
60: {
61: return $this->value;
62: }
63:
64: /**
65: * {@inheritdoc}
66: */
67: public function match(ModelInterface $model = null, PropertyValueBag $input = null)
68: {
69: return $this->value;
70: }
71:
72: /**
73: * {@inheritdoc}
74: */
75: public function __clone()
76: {
77: }
78: }
79: