| 1 | <?php |
||
| 24 | class JsonLd extends AbstractHelper |
||
| 25 | { |
||
| 26 | /** |
||
| 27 | * |
||
| 28 | * |
||
| 29 | * @var JobInterface |
||
| 30 | */ |
||
| 31 | private $job; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Print the JSON-LD representation of a job. |
||
| 35 | * |
||
| 36 | * Wraps it in <script type="application/ld+json"> tag |
||
| 37 | * |
||
| 38 | * @param JsonLdProvider|null $job |
||
| 39 | * |
||
| 40 | * @return string |
||
| 41 | */ |
||
| 42 | public function __invoke($job = null) |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Set the default job to use, if invoked without arguments. |
||
| 60 | * |
||
| 61 | * @param JobInterface $job |
||
| 62 | * |
||
| 63 | * @return self |
||
| 64 | */ |
||
| 65 | public function setJob(JobInterface $job) |
||
| 71 | |||
| 72 | |||
| 73 | |||
| 74 | } |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.