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 null?
12
 */
13
class IsNull extends BaseMatcher
14
{
15
 
16
    private static $_INSTANCE;
17
    private static $_NOT_INSTANCE;
18
 
19
    public function matches($item)
20
    {
21
        return is_null($item);
22
    }
23
 
24
    public function describeTo(Description $description)
25
    {
26
        $description->appendText('null');
27
    }
28
 
29
    /**
30
     * Matches if value is null.
31
     *
32
     * @factory
33
     */
34
    public static function nullValue()
35
    {
36
        if (!self::$_INSTANCE) {
37
            self::$_INSTANCE = new self();
38
        }
39
 
40
        return self::$_INSTANCE;
41
    }
42
 
43
    /**
44
     * Matches if value is not null.
45
     *
46
     * @factory
47
     */
48
    public static function notNullValue()
49
    {
50
        if (!self::$_NOT_INSTANCE) {
51
            self::$_NOT_INSTANCE = IsNot::not(self::nullValue());
52
        }
53
 
54
        return self::$_NOT_INSTANCE;
55
    }
56
}