for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of expect package.
*
* (c) Noritaka Horio <[email protected]>
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace expect;
use expect\registry\MatcherNotRegisteredException;
* Implementation of container.
* @author Noritaka Horio <[email protected]>
* @copyright Noritaka Horio <[email protected]>
* @see \expect\MatcherContainer
trait MatcherLookupTable
{
* Dictionary of matcher class.
* @var \expect\Dictionary
private $matchers;
* {@inheritdoc}
public function has($name)
return $this->matchers->containsKey($name);
}
* Find the matcher class by name.
* Returns true if it is not found.
* @param string $name macther name
* @return bool
public function hasNot($name)
return $this->has($name) === false;
public function get($name)
if ($this->hasNot($name)) {
throw new MatcherNotRegisteredException("$name is not registered");
$matcherClass = $this->matchers->get($name);
return $matcherClass;