-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConstraint.hh
More file actions
35 lines (28 loc) · 851 Bytes
/
Constraint.hh
File metadata and controls
35 lines (28 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?hh // strict
/**
* @copyright 2010-2015, The Titon Project
* @license http://opensource.org/licenses/bsd-license.php
* @link http://titon.io
*/
namespace Titon\Validate;
use Titon\Utility\Validate;
/**
* Default provider of constraints, which are inherited from the utility Validate class.
*
* @package Titon\Validate
*/
class Constraint extends Validate implements ConstraintProvider {
/**
* {@inheritdoc}
*/
public function getConstraints(): ConstraintMap {
$constraints = Map {};
$class = static::class;
foreach (get_class_methods($this) as $method) {
// UNSAFE
// Since `class_meth()` requires literal strings and we are passing variables
$constraints[$method] = class_meth($class, $method);
}
return $constraints;
}
}