for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Polidog\Chatwork\Entity\Collection;
use Polidog\Chatwork\Entity\EntityInterface;
use Polidog\Chatwork\Entity\Member;
class MemberCollection extends EntityCollection
{
public function add(EntityInterface $entity)
assert($entity instanceof Member);
return parent::add($entity);
}
/**
* @return array
*/
public function getAdminIds()
return $this->_getIds('admin');
public function getMemberIds()
return $this->_getIds('member');
public function getReadonlyIds()
return $this->_getIds('readonly');
* @param string $type
*
private function _getIds($type)
$ids = [];
foreach ($this->entities as $entity) {
if ($entity->role == $type) {
$ids[] = $entity->account->accountId;
return $ids;