Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
ValidationModelParser.php
Go to the documentation of this file.
1<?php
2
4
6use Ubiquity\utils\base\UArray;
7
13
14 protected $validators=[];
15
16 public function parse($modelClass) {
17 $instance=new $modelClass();
18 $properties=Reflexion::getProperties($instance);
19 foreach ( $properties as $property ) {
20 $propName=$property->getName();
21 $annots=Reflexion::getAnnotationsMember($modelClass, $propName, 'validator');
22 if(\count($annots)>0){
23 $this->validators[$propName]=[];
24 foreach ($annots as $annotation){
25 $this->validators[$propName][]=$annotation->getPropertiesAndValues();
26 }
27 }
28 }
29
30 }
31
32 public function getValidators(){
33 return $this->validators;
34 }
35
36 public function __toString() {
37 return "return " . UArray::asPhpArray($this->validators, "array") . ";";
38 }
39}
40
Reflection utilities in dev environment only.
Definition Reflexion.php:17
Validation managment.