for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* PHP Billing Library
*
* @link https://github.com/hiqdev/php-billing
* @package php-billing
* @license BSD-3-Clause
* @copyright Copyright (c) 2017, HiQDev (http://hiqdev.com/)
*/
namespace hiqdev\php\billing\target;
* @see TargetInterface
* @author Andrii Vasyliev <[email protected]>
abstract class AbstractTarget implements TargetInterface
{
* @var int|string
protected $id;
* @var string
protected $type;
public function __construct($id, $type)
$this->id = $id;
$this->type = $type;
}
* @return int
public function getId()
return $this->id;
* {@inheritdoc}
public function getType()
return $this->type;
* @return string
public function getUniqId()
return $this->type . ':' . $this->id;
* @return bool
public function equals(TargetInterface $other)
return $this->getUniqId() === $other->getUniqId();
public function jsonSerialize()
return get_object_vars($this);