| 1 | <?php |
||
| 8 | class ScrapedItemBag extends ItemBag |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var ScraperEntity |
||
| 12 | */ |
||
| 13 | protected $scraper; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @param ScraperEntity $scraper |
||
| 17 | * @param string $originalUrl |
||
| 18 | * @param string $originalData |
||
| 19 | */ |
||
| 20 | 26 | public function __construct(ScraperEntity $scraper, $originalUrl, $originalData) |
|
| 30 | |||
| 31 | /** |
||
| 32 | * @return string |
||
| 33 | */ |
||
| 34 | public function __toString() |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @return ScraperEntity |
||
| 41 | */ |
||
| 42 | 2 | public function getScraper() |
|
| 46 | |||
| 47 | /** |
||
| 48 | * @return string |
||
| 49 | */ |
||
| 50 | 14 | public function getOriginalData() |
|
| 54 | } |
||
| 55 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: