Fix bug in style changes for the Use cases on the live site.
[yaffs-website] / vendor / phpunit / phpunit / src / Framework / Constraint / ClassHasStaticAttribute.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 class it is evaluated for has a given
13  * static attribute.
14  *
15  * The attribute name is passed in the constructor.
16  *
17  * @since Class available since Release 3.1.0
18  */
19 class PHPUnit_Framework_Constraint_ClassHasStaticAttribute extends PHPUnit_Framework_Constraint_ClassHasAttribute
20 {
21     /**
22      * Evaluates the constraint for parameter $other. Returns true if the
23      * constraint is met, false otherwise.
24      *
25      * @param mixed $other Value or object to evaluate.
26      *
27      * @return bool
28      */
29     protected function matches($other)
30     {
31         $class = new ReflectionClass($other);
32
33         if ($class->hasProperty($this->attributeName)) {
34             $attribute = $class->getProperty($this->attributeName);
35
36             return $attribute->isStatic();
37         } else {
38             return false;
39         }
40     }
41
42     /**
43      * Returns a string representation of the constraint.
44      *
45      * @return string
46      *
47      * @since  Method available since Release 3.3.0
48      */
49     public function toString()
50     {
51         return sprintf(
52             'has static attribute "%s"',
53             $this->attributeName
54         );
55     }
56 }