public function adapt($value)
{
if ($value instanceof Matchable) {
return $value;
}
if (is_object($value)) {
foreach ($this->driverIndex as $className => $driver) {
if (is_a($value, $className)) {
return $driver->wrapMatcher($value);
}
}
}
if ('*' === $value) {
return $this->wildcardAnyMatcher;
}
if ('~' === $value) {
return $this->anyMatcher;
}
return new EqualToMatcher($value, true, $this->exporter);
}