Overview

Namespaces

  • None
  • Peridot
    • Leo
      • Formatter
      • Interfaces
        • Assert
      • Matcher
        • Template
      • ObjectPath
      • Responder
  • PHP

Classes

  • AbstractMatcher
  • CountableMatcher
  • EmptyMatcher
  • EqualMatcher
  • ExceptionMatcher
  • GreaterThanMatcher
  • GreaterThanOrEqualMatcher
  • InclusionMatcher
  • InstanceofMatcher
  • KeysMatcher
  • LengthMatcher
  • LessThanMatcher
  • LessThanOrEqualMatcher
  • Match
  • NullMatcher
  • PatternMatcher
  • PredicateMatcher
  • PropertyMatcher
  • RangeMatcher
  • SameMatcher
  • SubStringMatcher
  • TrueMatcher
  • TruthyMatcher
  • TypeMatcher

Interfaces

  • MatcherInterface
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: namespace Peridot\Leo\Matcher;
 3: 
 4: use Peridot\Leo\Matcher\Template\ArrayTemplate;
 5: use Peridot\Leo\Matcher\Template\TemplateInterface;
 6: 
 7: /**
 8:  * InstanceofMatcher determines if the actual value is an instance of the expected
 9:  * class string.
10:  *
11:  * @package Peridot\Leo\Matcher
12:  */
13: class InstanceofMatcher extends AbstractMatcher
14: {
15:     /**
16:      * See if actual value is an instance of the expected class.
17:      *
18:      * @param mixed $actual
19:      * @return bool
20:      */
21:     protected function doMatch($actual)
22:     {
23:         return $actual instanceof $this->expected;
24:     }
25: 
26:     /**
27:      * {@inheritdoc}
28:      *
29:      * @return TemplateInterface
30:      */
31:     public function getDefaultTemplate()
32:     {
33:         return new ArrayTemplate([
34:             'default' => 'Expected {{actual}} to be instance of {{expected}}',
35:             'negated' => 'Expected {{actual}} to not be an instance of {{expected}}'
36:         ]);
37:     }
38: }
39: 
Leo API documentation generated by ApiGen