| 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 | 45 | public function __construct(Media $mediaObj, $data) |
|
| 24 | { |
||
| 25 | 45 | $this->url = $data['url']; |
|
| 26 | |||
| 27 | 45 | $this->title = $data['title']; |
|
| 28 | |||
| 29 | 45 | $this->description = $data['description']; |
|
| 30 | |||
| 31 | 45 | $this->images = $data['images']; |
|
| 32 | |||
| 33 | 45 | $this->meta = new Meta($data['meta']); |
|
| 34 | |||
| 35 | 45 | $media = $mediaObj->get($data['url']); |
|
| 36 | |||
| 37 | 45 | if ($media !== []) { |
|
| 38 | 3 | $this->media = $media; |
|
|
|
|||
| 39 | 3 | } |
|
| 40 | |||
| 41 | 45 | $this->viewPath = __DIR__ . '/Templates'; |
|
| 42 | 45 | } |
|
| 43 | |||
| 44 | /** |
||
| 45 | * @param string $viewPath |
||
| 46 | */ |
||
| 47 | 3 | public function setViewPath($viewPath) |
|
| 51 | |||
| 52 | /** |
||
| 53 | * @param string $type |
||
| 54 | * @return string |
||
| 55 | */ |
||
| 56 | 15 | public function render($type = null) |
|
| 71 | |||
| 72 | /** |
||
| 73 | * @return array |
||
| 74 | */ |
||
| 75 | 18 | public function toArray() |
|
| 95 | |||
| 96 | /** |
||
| 97 | * @return string |
||
| 98 | */ |
||
| 99 | 3 | public function toJson() |
|
| 103 | } |
||
| 104 |
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..