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
use Hamcrest\Matcher;
10
use Hamcrest\Util;
11
 
12
/**
13
 * Calculates the logical negation of a matcher.
14
 */
15
class IsNot extends BaseMatcher
16
{
17
 
18
    private $_matcher;
19
 
20
    public function __construct(Matcher $matcher)
21
    {
22
        $this->_matcher = $matcher;
23
    }
24
 
25
    public function matches($arg)
26
    {
27
        return !$this->_matcher->matches($arg);
28
    }
29
 
30
    public function describeTo(Description $description)
31
    {
32
        $description->appendText('not ')->appendDescriptionOf($this->_matcher);
33
    }
34
 
35
    /**
36
     * Matches if value does not match $value.
37
     *
38
     * @factory
39
     */
40
    public static function not($value)
41
    {
42
        return new self(Util::wrapValueWithIsEqual($value));
43
    }
44
}