| Total Complexity | 9 |
| Total Lines | 77 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class DefaultContext implements DefaultsProviderContextInterface |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var callable |
||
| 13 | */ |
||
| 14 | private $defaultsProvider; |
||
| 15 | /** |
||
| 16 | * @var string[] |
||
| 17 | */ |
||
| 18 | private $views = []; |
||
| 19 | private $validate = true; |
||
| 20 | private $strictMode = false; |
||
| 21 | /** |
||
| 22 | * @inheritDoc |
||
| 23 | */ |
||
| 24 | public function useStrictMode(): bool |
||
| 25 | { |
||
| 26 | return $this->strictMode; |
||
| 27 | } |
||
| 28 | |||
| 29 | public function setStrictMode(bool $value): DefaultContext |
||
| 30 | { |
||
| 31 | $this->strictMode = $value; |
||
| 32 | return $this; |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @inheritDoc |
||
| 37 | */ |
||
| 38 | public function useValidation(): bool |
||
| 39 | { |
||
| 40 | return $this->validate; |
||
| 41 | } |
||
| 42 | |||
| 43 | public function setValidation(bool $value): DefaultContext |
||
| 44 | { |
||
| 45 | $this->validate = $value; |
||
| 46 | return $this; |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @param callable $defaultsProvider |
||
| 51 | * @return $this |
||
| 52 | */ |
||
| 53 | public function setDefaultsProvider(callable $defaultsProvider) |
||
| 54 | { |
||
| 55 | $this->defaultsProvider = $defaultsProvider; |
||
| 56 | return $this; |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @param string[] $views |
||
| 61 | * @return $this |
||
| 62 | */ |
||
| 63 | public function setViews(array $views) |
||
| 64 | { |
||
| 65 | $this->views = $views; |
||
| 66 | return $this; |
||
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @inheritDoc |
||
| 71 | */ |
||
| 72 | public function getViews(): array |
||
| 73 | { |
||
| 74 | return $this->views; |
||
| 75 | } |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @inheritDoc |
||
| 79 | */ |
||
| 80 | public function computeDefaults(string $className, ClassMappingInterface $mapping): array |
||
| 86 | } |
||
| 87 | } |
||
| 88 |