for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace TreeHouse\IoBundle\Scrape;
use TreeHouse\IoBundle\Entity\Scraper as ScraperEntity;
use TreeHouse\IoBundle\Item\ItemBag;
class ScrapedItemBag extends ItemBag
{
/**
* @var ScraperEntity
*/
protected $scraper;
* @param ScraperEntity $scraper
* @param string $originalUrl
* @param string $originalData
public function __construct(ScraperEntity $scraper, $originalUrl, $originalData)
parent::__construct([]);
$this->scraper = $scraper;
$this->originalUrl = $originalUrl;
$this->originalData = $originalData;
originalData
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
$this->setOriginalId(md5($originalUrl));
}
* @return string
public function __toString()
return sprintf('%s:%s', $this->scraper->getOrigin()->getName(), $this->originalUrl);
* @return ScraperEntity
public function getScraper()
return $this->scraper;
public function getOriginalData()
return $this->originalData;
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: