1 | <?php |
||
7 | class Preview |
||
8 | { |
||
9 | public $url; |
||
10 | |||
11 | public $title; |
||
12 | |||
13 | public $description; |
||
14 | |||
15 | public $images; |
||
16 | |||
17 | public $meta; |
||
18 | |||
19 | public $media = false; |
||
20 | |||
21 | private $viewPath; |
||
22 | |||
23 | 75 | public function __construct(Media $mediaObj, $data) |
|
24 | { |
||
25 | 75 | $this->url = $data['url']; |
|
26 | |||
27 | 75 | $this->title = $data['title']; |
|
28 | |||
29 | 75 | $this->description = $data['description']; |
|
30 | |||
31 | 75 | $this->images = $data['images']; |
|
32 | |||
33 | 75 | $this->meta = new Meta($data['meta']); |
|
34 | |||
35 | 75 | $media = $mediaObj->get($data['url']); |
|
36 | |||
37 | 75 | if ($media !== []) { |
|
38 | 6 | $this->media = $media; |
|
|
|||
39 | 6 | } |
|
40 | |||
41 | 75 | $this->viewPath = __DIR__ . '/Templates'; |
|
42 | 75 | } |
|
43 | |||
44 | /** |
||
45 | * @param string $viewPath |
||
46 | */ |
||
47 | 3 | public function setViewPath($viewPath) |
|
51 | |||
52 | /** |
||
53 | * @param string $type |
||
54 | * @return string |
||
55 | */ |
||
56 | 18 | public function render($type = null) |
|
70 | |||
71 | /** |
||
72 | * @return array |
||
73 | */ |
||
74 | 21 | public function toArray() |
|
94 | |||
95 | /** |
||
96 | * @return string |
||
97 | */ |
||
98 | 3 | public function toJson() |
|
102 | } |
||
103 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..