1 | <?php |
||
24 | final class ArticleHydrator implements ArticleHydratorInterface |
||
25 | { |
||
26 | /** |
||
27 | * @var RouteProviderInterface |
||
28 | */ |
||
29 | private $routeProvider; |
||
30 | |||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | private $allowedTypes = [ |
||
35 | ItemInterface::TYPE_PICTURE, |
||
36 | ItemInterface::TYPE_FILE, |
||
37 | ItemInterface::TYPE_TEXT, |
||
38 | ItemInterface::TYPE_COMPOSITE, |
||
39 | ]; |
||
40 | |||
41 | /** |
||
42 | * ArticleHydrator constructor. |
||
43 | * |
||
44 | * @param RouteProviderInterface $routeProvider |
||
45 | */ |
||
46 | 21 | public function __construct(RouteProviderInterface $routeProvider) |
|
50 | |||
51 | /** |
||
52 | * {@inheritdoc} |
||
53 | */ |
||
54 | 6 | public function hydrate(ArticleInterface $article, PackageInterface $package): ArticleInterface |
|
70 | |||
71 | /** |
||
72 | * @param PackageInterface $package |
||
73 | * |
||
74 | * @return string |
||
75 | */ |
||
76 | 6 | protected function populateLead(PackageInterface $package) |
|
88 | |||
89 | /** |
||
90 | * @param PackageInterface $package |
||
91 | * |
||
92 | * @return string |
||
93 | */ |
||
94 | protected function populateBody(PackageInterface $package) |
||
102 | |||
103 | /** |
||
104 | * @param string $type |
||
105 | * |
||
106 | * @throws \InvalidArgumentException |
||
107 | */ |
||
108 | 3 | protected function ensureTypeIsAllowed(string $type) |
|
118 | } |
||
119 |