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;
* @see TargetInterface
* @author Andrii Vasyliev <[email protected]>
abstract class AbstractTarget implements TargetInterface
{
public function __construct($type, $id)
$this->id = $id;
id
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
$this->type = $type;
type
$this->uniqId = $type . ':' . $id;
uniqId
}
* @return int
public function getId()
return $this->id;
* {@inheritdoc}
public function getType()
return $this->type;
* @return string
public function getUniqId()
return $this->uniqId;
* @return bool
public function equals(TargetInterface $other)
return $this->uniqId === $other->getUniqId();
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: