]>
Commit | Line | Data |
---|---|---|
4f5b44bd NL |
1 | <?php |
2 | ||
3 | /* | |
4 | * This file is part of the Symfony package. | |
5 | * | |
6 | * (c) Fabien Potencier <fabien@symfony.com> | |
7 | * | |
8 | * For the full copyright and license information, please view the LICENSE | |
9 | * file that was distributed with this source code. | |
10 | */ | |
11 | ||
12 | namespace Symfony\Component\PropertyAccess; | |
13 | ||
14 | /** | |
15 | * A configurable builder for PropertyAccessorInterface objects. | |
16 | * | |
17 | * @author Jérémie Augustin <jeremie.augustin@pixel-cookers.com> | |
18 | */ | |
19 | class PropertyAccessorBuilder | |
20 | { | |
21 | /** | |
22 | * @var Boolean | |
23 | */ | |
24 | private $magicCall = false; | |
25 | ||
26 | /** | |
27 | * Enables the use of "__call" by the ProperyAccessor. | |
28 | * | |
29 | * @return PropertyAccessorBuilder The builder object | |
30 | */ | |
31 | public function enableMagicCall() | |
32 | { | |
33 | $this->magicCall = true; | |
34 | ||
35 | return $this; | |
36 | } | |
37 | ||
38 | /** | |
39 | * Disables the use of "__call" by the ProperyAccessor. | |
40 | * | |
41 | * @return PropertyAccessorBuilder The builder object | |
42 | */ | |
43 | public function disableMagicCall() | |
44 | { | |
45 | $this->magicCall = false; | |
46 | ||
47 | return $this; | |
48 | } | |
49 | ||
50 | /** | |
51 | * @return Boolean true if the use of "__call" by the ProperyAccessor is enabled | |
52 | */ | |
53 | public function isMagicCallEnabled() | |
54 | { | |
55 | return $this->magicCall; | |
56 | } | |
57 | ||
58 | /** | |
59 | * Builds and returns a new propertyAccessor object. | |
60 | * | |
61 | * @return PropertyAccessorInterface The built propertyAccessor | |
62 | */ | |
63 | public function getPropertyAccessor() | |
64 | { | |
65 | return new PropertyAccessor($this->magicCall); | |
66 | } | |
67 | } |