protected function searchForAttr($name, $value = null)
{
$found = new \SplObjectStorage();
$matches = $this->candidateList();
foreach ($matches as $candidate) {
if ($candidate->hasAttribute($name)) {
// If value is required, match that, too.
if (isset($value) && $value == $candidate->getAttribute($name)) {
$found->attach($candidate);
} else {
$found->attach($candidate);
}
}
}
$this->matches = $found;
}