for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace FlatPlan\Components;
abstract class AbstractComponent {
protected $role;
protected $layout = 'layout';
protected $style = 'style';
protected $textStyle = 'textStyle';
abstract public function getComponent();
public function setRole($role)
{
if (!in_array($role, $this->roles)) {
throw new \ErrorException('Invalid role supplied.');
}
$this->role = $role;
$this->updateStyles($role);
public function getRole()
return $this->role;
public function setIdentifier($identifier)
$this->identifier = $identifier;
identifier
public function getIdentifier()
return $this->identifier;
public function updateStyles($role)
$this->layout = $role . ucfirst($this->layout);
$this->style = $role . ucfirst($this->style);
$this->textStyle = $role . ucfirst($this->textStyle);
if (isset($this->components)) {
foreach ($this->components as $component) {
$component->updateStyles($role);
public function __toString()
return json_encode($this->getComponent());