for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Src\UseCases\Domain\Context\Model;
class Interaction
{
private $follow;
private $applause;
private $done;
private $pageId;
private $doneValue;
public function __construct(
int $pageId,
bool $follow,
bool $applause,
bool $done,
array $doneValue = []
)
$this->pageId = $pageId;
$this->done = $done;
$this->follow = $follow;
$this->applause = $applause;
$this->doneValue = $doneValue;
}
public function pageId():int
return $this->pageId;
public function update(array $interactions, array $doneValue = [])
foreach ($interactions as $interaction){
switch ($interaction){
case 'follow':
$this->follow = true;
break;
case 'unfollow':
$this->follow = false;
case 'done':
$this->done = true;
case 'undone':
$this->done = false;
$this->doneValue = null;
case 'applause':
$this->applause = true;
case 'unapplause':
$this->applause = false;
public function toArray():array
return [
'done' => $this->done,
'follow' => $this->follow,
'applause' => $this->applause,
'value' => $this->doneValue,
'page_id' => $this->pageId
];