Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
<?php /** * ArrayValidator ... checks array length * * Parameters: * 'min' * 'max' */ class ArrayValidator extends AgaviValidator { /** * Validates the input. * * @return bool The value is in the array. */ protected function validate() { $value = $this->getData($this->getArgument() ); if (!is_array($value) ) { $this->throwError(); return false; } $size = count($value); if ($this->hasParameter('min') ) { if ($size < $this->getParameter('min') ) { $this->throwError('min'); return false; } } if ($this->hasParameter('max') ) { if ($size > $this->getParameter('max') ) { $this->throwError('max'); return false; } } return true; } } ?>
This paste will be private.
From the Design Piracy series on my blog: