for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PhpUnitGen\Model;
use PhpUnitGen\Model\ModelInterface\AttributeModelInterface;
use PhpUnitGen\Model\ModelInterface\TraitModelInterface;
/**
* Class TraitModel.
*
* @author Paul Thébaud <[email protected]>.
* @copyright 2017-2018 Paul Thébaud <[email protected]>.
* @license https://opensource.org/licenses/MIT The MIT license.
* @link https://github.com/paul-thebaud/phpunit-generator
* @since Class available since Release 2.0.0.
*/
class TraitModel extends InterfaceModel implements TraitModelInterface
{
* @var AttributeModelInterface[] $attributes Class attributes.
private $attributes = [];
* {@inheritdoc}
public function addAttribute(AttributeModelInterface $attribute): void
$this->attributes[] = $attribute;
}
public function hasAttribute(string $name): bool
foreach ($this->attributes as $attribute) {
if ($attribute->getName() === $name) {
return true;
return false;
public function getAttribute(string $name): ?AttributeModelInterface
return $attribute;
return null;
public function getAttributes(): array
return $this->attributes;