| Total Complexity | 7 |
| Total Lines | 81 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 14 | final class NormalizationLinkMappingBuilder implements NormalizationLinkMappingBuilderInterface |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @var string |
||
| 18 | */ |
||
| 19 | private $name; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var array |
||
| 23 | */ |
||
| 24 | private $groups = []; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var LinkNormalizerInterface |
||
| 28 | */ |
||
| 29 | private $linkNormalizer; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @var PolicyInterface|null |
||
| 33 | */ |
||
| 34 | private $policy; |
||
| 35 | |||
| 36 | private function __construct(string $name) |
||
| 37 | { |
||
| 38 | $this->name = $name; |
||
| 39 | 4 | } |
|
| 40 | |||
| 41 | 4 | public static function create( |
|
| 42 | 4 | string $name, |
|
| 43 | LinkNormalizerInterface $linkNormalizer |
||
| 44 | ): NormalizationLinkMappingBuilderInterface { |
||
| 45 | $self = new self($name); |
||
| 46 | $self->linkNormalizer = $linkNormalizer; |
||
| 47 | |||
| 48 | return $self; |
||
| 49 | } |
||
| 50 | 2 | ||
| 51 | public static function createCallback( |
||
| 52 | string $name, |
||
| 53 | callable $callback |
||
| 54 | 2 | ): NormalizationLinkMappingBuilderInterface { |
|
| 55 | 2 | $self = new self($name); |
|
| 56 | $self->linkNormalizer = new CallbackLinkNormalizer($callback); |
||
| 57 | 2 | ||
| 58 | return $self; |
||
| 59 | } |
||
| 60 | |||
| 61 | public static function createLink( |
||
| 69 | } |
||
| 70 | 1 | ||
| 71 | 1 | /** |
|
| 72 | * @deprecated |
||
| 73 | 1 | */ |
|
| 74 | public function setGroups(array $groups): NormalizationLinkMappingBuilderInterface |
||
| 75 | { |
||
| 76 | $this->groups = $groups; |
||
| 77 | |||
| 78 | return $this; |
||
| 79 | } |
||
| 80 | |||
| 81 | public function setPolicy(PolicyInterface $policy): NormalizationLinkMappingBuilderInterface |
||
| 86 | 1 | } |
|
| 87 | 1 | ||
| 88 | public function getMapping(): NormalizationLinkMappingInterface |
||
| 95 | ); |
||
| 96 | } |
||
| 97 | } |
||
| 98 |