BooleanValidator
なかったので作ってみた
<?php /** * BooleanValidator allows you to validate boolean input. * * @author MugeSo <mugeso@mugeso.com> * * @version $Id$ */ class BooleanValidator extends AgaviValidator { /** * Validates the input. * * @return bool * * @author MugeSo <mugeso@mugeso.com> */ protected function validate() { $originalValue =& $this->getData($this->getArgument()); $value = AgaviToolkit::literalize($originalValue); if(!is_bool($value)) { $this->throwError('type'); return false; } if($this->hasParameter('value') && $this->getParameter('value') !== $value) { $this->throwError('value'); return false; } $this->export($value); return true; } } ?>
requiredがfalseのときにfalseをexportするようにしたいけど面倒だからやめといた