StringNotContains.php

Go to the documentation of this file.
00001 <?php
00002 
00031 class Robo47_Validate_StringNotContains extends Robo47_Validate_StringContains
00032 {
00033     
00034     protected $_messageTemplates = array(
00035         self::CONTAINS => "'%value%' does contain '%contains%'"
00036     );
00037 
00041     public function isValid($value)
00042     {
00043         $this->_setValue($value);
00044         $isValid = true;
00045         foreach ($this->_contains as $contains) {
00046             if (false !== strpos($value, $contains)) {
00047                 $isValid = false;
00048                 $this->_createMessage(self::CONTAINS, $contains);
00049                 break;
00050             }
00051         }
00052         return $isValid;
00053     }
00054 }