for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace FlatPlan\Components;
class Social extends AbstractComponent {
protected $url;
protected $roles = ['instagram', 'facebook_post', 'tweet'];
/**
* @param string $role
* @param string $url
* @return void
*/
public function __construct($role, $url)
{
$this->setRole($role);
$this->setUrl($url);
}
private function setUrl($url)
if (!filter_var($url, FILTER_VALIDATE_URL)) {
throw new \ErrorException('Invalid url supplied.');
$this->url = $url;
private function getUrl()
return $this->url;
protected function getComponent()
$component = new \stdClass();
$component->role = $this->getRole();
$component->url = $this->getUrl();
return $component;