src/Expectation.php
public function _matcher($matcherName, $actual)
    {
        if (!Matcher::exists($matcherName, true)) {
            throw new Exception("Unexisting matcher attached to `'{$matcherName}'`.");
        }

        $matcher = null;

        foreach (Matcher::get($matcherName, true) as $target => $value) {
            if (!$target) {
                $matcher = $value;
                continue;
            }
            if ($actual instanceof $target) {
                $matcher = $value;
            }
        }

        if (!$matcher) {
            throw new Exception("Unexisting matcher attached to `'{$matcherName}'` for `{$target}`.");
        }

        return $matcher;
    }
public function _matcher($matcherName, $actual)
    {
        if (!Matcher::exists($matcherName, true)) {
            throw new Exception("Unexisting matcher attached to `'{$matcherName}'`.");
        }

        $matcher = null;

        foreach (Matcher::get($matcherName, true) as $target => $value) {
            if (!$target) {
                $matcher = $value;
                continue;
            }
            if ($actual instanceof $target) {
                $matcher = $value;
            }
        }

        if (!$matcher) {
            throw new Exception("Unexisting matcher attached to `'{$matcherName}'` for `{$target}`.");
        }

        return $matcher;
    }
public function _matcher ( $ matcherName , $ actual ) { if ( ! Matcher :: exists ( $ matcherName , true ) ) { throw new Exception ( "Unexisting matcher attached to `'{$matcherName}'`." ) ; } $ matcher = null ; foreach ( Matcher :: get ( $ matcherName , true ) as $ target => $ value ) { if ( ! $ target ) { $ matcher = $ value ; continue ; } if ( $ actual instanceof $ target ) { $ matcher = $ value ; } } if ( ! $ matcher ) { throw new Exception ( "Unexisting matcher attached to `'{$matcherName}'` for `{$target}`." ) ; } return $ matcher ; }
Returns a compatible matcher class name according to a passed actual value.

@param  string $matcherName The name of the matcher.
@param  mixed  $actual      The actual value.
@return string              A matcher class name.
Returns a compatible matcher class name according to a passed actual value .