Created
September 17, 2013 10:05
-
-
Save rjd22/6592383 to your computer and use it in GitHub Desktop.
Ugly example of a wrapped kohana validation class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Validate_Template | |
{ | |
/** | |
* @var Validation | |
*/ | |
private $_validation; | |
public function load(array $data, $validation = FALSE) | |
{ | |
$this->_validation = $validation; | |
if ($validation === FALSE) | |
{ | |
$this->_validation = new Validation($data); | |
} | |
} | |
public function rules(array $field_rules) | |
{ | |
foreach ($field_rules as $field => $rules) | |
{ | |
$this->_validation->rules($field, $rules); | |
} | |
return $this->_validation; | |
} | |
public function check() | |
{ | |
return $this->_validation->check(); | |
} | |
public function errors() | |
{ | |
return $this->_validation->errors('validation'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment