Skip to content

Commit 2dee471

Browse files
committed
self-validate
1 parent 691f40b commit 2dee471

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/Schema.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ public function in($data, Context $options = null)
125125
}
126126

127127

128+
/**
129+
* @param $data
130+
* @param Context|null $options
131+
* @return array|mixed|null|object|\stdClass
132+
* @throws InvalidValue
133+
*/
128134
public function out($data, Context $options = null)
129135
{
130136
if ($options === null) {
@@ -136,6 +142,14 @@ public function out($data, Context $options = null)
136142
return $this->process($data, $options);
137143
}
138144

145+
/**
146+
* @param $data
147+
* @param Context $options
148+
* @param string $path
149+
* @param null $result
150+
* @return array|mixed|null|object|\stdClass
151+
* @throws InvalidValue
152+
*/
139153
public function process($data, Context $options, $path = '#', $result = null)
140154
{
141155

src/Structure/ClassStructure.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,9 @@ public static function className()
130130
{
131131
return get_called_class();
132132
}
133+
134+
public function validate()
135+
{
136+
static::schema()->out($this);
137+
}
133138
}

0 commit comments

Comments
 (0)