Validation.php
2.28 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php 
namespace Phalcon {
	/**
	 * Phalcon\Validation
	 *
	 * Allows to validate data using validators
	 */
	
	class Validation extends \Phalcon\DI\Injectable implements \Phalcon\Events\EventsAwareInterface, \Phalcon\DI\InjectionAwareInterface {
		protected $_data;
		protected $_entity;
		protected $_validators;
		protected $_filters;
		protected $_messages;
		protected $_values;
		/**
		 * \Phalcon\Validation constructor
		 *
		 * @param array $validators
		 */
		public function __construct($validators=null){ }
		/**
		 * Validate a set of data according to a set of rules
		 *
		 * @param array|object $data
		 * @param object $entity
		 * @return \Phalcon\Validation\Message\Group
		 */
		public function validate($data=null, $entity=null){ }
		/**
		 * Adds a validator to a field
		 *
		 * @param string $attribute
		 * @param \Phalcon\Validation\ValidatorInterface
		 * @return \Phalcon\Validation
		 */
		public function add($attribute, $validator){ }
		/**
		 * Adds filters to the field
		 *
		 * @param string $attribute
		 * @param array|string $attribute
		 * @return \Phalcon\Validation
		 */
		public function setFilters($attribute, $filters){ }
		/**
		 * Returns all the filters or a specific one
		 *
		 * @param string $attribute
		 * @return mixed
		 */
		public function getFilters($attribute=null){ }
		/**
		 * Returns the validators added to the validation
		 *
		 * @return array
		 */
		public function getValidators(){ }
		/**
		 * Returns the bound entity
		 *
		 * @return object
		 */
		public function getEntity(){ }
		/**
		 * Returns the registered validators
		 *
		 * @return \Phalcon\Validation\Message\Group
		 */
		public function getMessages(){ }
		/**
		 * Appends a message to the messages list
		 *
		 * @param \Phalcon\Validation\MessageInterface $message
		 * @return \Phalcon\Validation
		 */
		public function appendMessage($message){ }
		/**
		 * Assigns the data to an entity
		 * The entity is used to obtain the validation values
		 *
		 * @param object $entity
		 * @param object|array $data
		 * @return \Phalcon\Validation
		 */
		public function bind($entity, $data){ }
		/**
		 * Gets the a value to validate in the array/object data source
		 *
		 * @param string $attribute
		 * @return mixed
		 */
		public function getValue($attribute){ }
	}
}