Changeset 370
- Timestamp:
- 03/13/07 14:45:43 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/util/validators/stubEqualValidator.php
r151 r370 26 26 */ 27 27 protected $expected = null; 28 28 29 29 /** 30 30 * constructor … … 33 33 * @throws stubValidatorException 34 34 */ 35 public function __construct($expected)36 {37 if (is_scalar($expected) == false && null != $expected) {38 throw new stubValidatorException('Can only compare scalar values and null.');39 }40 41 $this->expected = $expected;42 }35 public function __construct($expected) 36 { 37 if (is_scalar($expected) == false && null != $expected) { 38 throw new stubValidatorException('Can only compare scalar values and null.'); 39 } 40 41 $this->expected = $expected; 42 } 43 43 44 44 /** … … 47 47 * @param scalar|null $value 48 48 * @return bool true if value is equal to expected value, else false 49 * @throws stubValidatorException50 49 */ 51 50 public function validate($value) 52 51 { 53 if (is_scalar($value) == false && null != $value) {54 throw new stubValidatorException('Can only compare scalar values and null.');55 }56 57 52 if ($this->expected !== $value) { 58 53 return false;
