for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Phossa Project
*
* PHP version 5.4
* @category Library
* @package Phossa2\Shared
* @copyright Copyright (c) 2016 phossa.com
* @license http://mit-license.org/ MIT License
* @link http://www.phossa.com/
*/
/*# declare(strict_types=1); */
namespace Phossa2\Shared\Reference;
use Phossa2\Shared\Message\Message;
use Phossa2\Shared\Exception\NotFoundException;
* DelegatorAwareTrait
* Implmentation of DelegatorAwareInterface
* @author Hong Zhang <[email protected]>
* @see DelegatorAwareInterface
* @version 2.0.8
* @since 2.0.8 added
trait DelegatorAwareTrait
{
* the delegator
* @var DelegatorInterface
* @access protected
protected $delegator;
* {@inheritDoc}
public function setDelegator(DelegatorInterface $delegator)
$this->delegator = $delegator;
$delegator->addToLookup($this);
return $this;
}
public function hasDelegator()/*# : bool */
return null !== $this->delegator;
public function getDelegator()/*# : DelegatorInterface */
if ($this->hasDelegator()) {
return $this->delegator;
throw new NotFoundException(
Message::get(Message::MSG_DELEGATOR_UNKNOWN, get_called_class()),
Message::MSG_DELEGATOR_UNKNOWN
);