| Total Complexity | 9 |
| Total Lines | 97 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class DefaultContext implements ContextInterface |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var bool |
||
| 11 | */ |
||
| 12 | private $removeUnknownParameters = true; |
||
| 13 | /** |
||
| 14 | * @var string[] |
||
| 15 | */ |
||
| 16 | private $ignoredParameters = []; |
||
| 17 | /** |
||
| 18 | * @var string[] |
||
| 19 | */ |
||
| 20 | private $path = []; |
||
| 21 | /** |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | private $className; |
||
| 25 | |||
| 26 | public static function from(ContextInterface $context): DefaultContext |
||
| 27 | { |
||
| 28 | return (new DefaultContext()) |
||
| 29 | ->setRemoveUnknownParameters($context->shouldRemoveUnknownParameters()) |
||
| 30 | ->setIgnoredParameters($context->getIgnoredParameters()) |
||
| 31 | ->setPath($context->getPath()); |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @return bool |
||
| 36 | */ |
||
| 37 | public function shouldRemoveUnknownParameters(): bool |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @param bool $removeUnknownParameters |
||
| 44 | * @return $this |
||
| 45 | */ |
||
| 46 | public function setRemoveUnknownParameters(bool $removeUnknownParameters) |
||
| 47 | { |
||
| 48 | $this->removeUnknownParameters = $removeUnknownParameters; |
||
| 49 | return $this; |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @return string[] |
||
| 54 | */ |
||
| 55 | public function getIgnoredParameters(): array |
||
| 56 | { |
||
| 57 | return $this->ignoredParameters; |
||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @param string[] $ignoredParameters |
||
| 62 | * @return $this |
||
| 63 | */ |
||
| 64 | public function setIgnoredParameters(array $ignoredParameters) |
||
| 65 | { |
||
| 66 | $this->ignoredParameters = $ignoredParameters; |
||
| 67 | return $this; |
||
| 68 | } |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @return string[] |
||
| 72 | */ |
||
| 73 | public function getPath(): array |
||
| 74 | { |
||
| 75 | return $this->path; |
||
| 76 | } |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @param string[] $path |
||
| 80 | * @return $this |
||
| 81 | */ |
||
| 82 | public function setPath(array $path) |
||
| 83 | { |
||
| 84 | $this->path = $path; |
||
| 85 | return $this; |
||
| 86 | } |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @return string |
||
| 90 | */ |
||
| 91 | public function getClassName(): string |
||
| 92 | { |
||
| 93 | return $this->className; |
||
| 94 | } |
||
| 95 | |||
| 96 | /** |
||
| 97 | * @param string $className |
||
| 98 | * @return $this |
||
| 99 | */ |
||
| 100 | public function setClassName(string $className) |
||
| 104 | } |
||
| 105 | } |
||
| 106 |