Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
namespace Hamcrest\Core;
3
 
4
/*
5
 Copyright (c) 2009 hamcrest.org
6
 */
7
use Hamcrest\BaseMatcher;
8
use Hamcrest\Description;
9
 
10
/**
11
 * Is the value the same object as another value?
12
 * In PHP terms, does $a === $b?
13
 */
14
class IsSame extends BaseMatcher
15
{
16
 
17
    private $_object;
18
 
19
    public function __construct($object)
20
    {
21
        $this->_object = $object;
22
    }
23
 
24
    public function matches($object)
25
    {
26
        return ($object === $this->_object) && ($this->_object === $object);
27
    }
28
 
29
    public function describeTo(Description $description)
30
    {
31
        $description->appendText('sameInstance(')
32
                                ->appendValue($this->_object)
33
                                ->appendText(')')
34
                                ;
35
    }
36
 
37
    /**
38
     * Creates a new instance of IsSame.
39
     *
40
     * @param mixed $object
41
     *   The predicate evaluates to true only when the argument is
42
     *   this object.
43
     *
44
     * @return \Hamcrest\Core\IsSame
45
     * @factory
46
     */
47
    public static function sameInstance($object)
48
    {
49
        return new self($object);
50
    }
51
}