b67eae41d14900a0b0a1b0631d7afb05bf2566b6
[yaffs-website] / vendor / phpunit / phpunit / src / Framework / Constraint / GreaterThan.php
1 <?php
2 /*
3  * This file is part of PHPUnit.
4  *
5  * (c) Sebastian Bergmann <sebastian@phpunit.de>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 /**
12  * Constraint that asserts that the value it is evaluated for is greater
13  * than a given value.
14  *
15  * @since Class available since Release 3.0.0
16  */
17 class PHPUnit_Framework_Constraint_GreaterThan extends PHPUnit_Framework_Constraint
18 {
19     /**
20      * @var numeric
21      */
22     protected $value;
23
24     /**
25      * @param numeric $value
26      */
27     public function __construct($value)
28     {
29         parent::__construct();
30         $this->value = $value;
31     }
32
33     /**
34      * Evaluates the constraint for parameter $other. Returns true if the
35      * constraint is met, false otherwise.
36      *
37      * @param mixed $other Value or object to evaluate.
38      *
39      * @return bool
40      */
41     protected function matches($other)
42     {
43         return $this->value < $other;
44     }
45
46     /**
47      * Returns a string representation of the constraint.
48      *
49      * @return string
50      */
51     public function toString()
52     {
53         return 'is greater than ' . $this->exporter->export($this->value);
54     }
55 }