Asserts that a string does not match a given format string.

@param string $format
@param string $message
@return $this
19793
public function assertStringNotMatchesFormat($format, $message = '')
    {
        Assert::assertStringNotMatchesFormat($format, $this->getData(), $message);

        return $this;
    }
744893
public function date($message = null, $format = null, $separator = '')
    {
        $this->setRule(__FUNCTION__, function($val, $args)
                       {

                           if (strlen(trim($val)) === 0) {
                               return TRUE;
                           }

                           try {
                               $dt = new \DateTime($val, new \DateTimeZone("UTC"));
                               return true;
                           } catch(\Exception $e) {
                               return false;
                           }

                       }, $message, array($format, $separator));
        return $this;
    }
994203
public function format(string $format) : self
    {
        if (! in_array($format, self::VALID_FORMATS)) {
            throw new Exception('Invalid format provided to path.');
        }

        $this->format = $format;

        return $this;
    }
320279
public function assertSameSize($expected, $message = '')
    {
        Assert::assertSameSize($expected, $this->getData(), $message);

        return $this;
    }
167823
protected function assertRegExp($pattern, $string, $message = '')
    {
        \PHPUnit\Framework\Assert::assertRegExp($pattern, $string, $message);
    }
994291
public function match($regex)
    {
        $matches = preg_match($regex, $this->value);
        $message = ['%s {{does not match|matches}} the regular expression %s', $this->value, $regex];
        $this->assert((!empty($matches)), $message);

        return $this;
    }
599308
public static function isValidDateFormat($format)
    {
        if (empty($format) || !is_string($format)) {
            return false;
        }

        $formatted = (new DateTime())->format($format);

        // Formatted date it's the format who is validated?
        // The format is invalid
        if ($formatted === $format) {
            return false;
        }

        // Validate the format used to create the datetime
        $fromFormat = DateTime::createFromFormat($format, $formatted);

        // It's instance of DateTime?
        // The format is valid
        if ($fromFormat instanceof DateTime) {
            return true;
        }

        return $fromFormat instanceof DateTime;
    }
1047853
public function setMessage(string $message)
    {
        if (strlen($message) > 0) {
            $properties = $this->getProperties();
            $properties['message'] = $message;
            $this->setProperties($properties);
            return $this;
        }
        return false;
    }
64607
public function setFormat($format)
    {
        if ($format !== self::FORMAT_BINARY && $format !== self::FORMAT_TEXT) {
            throw new InvalidArgumentException("Invalid message format");
        }

        $this->format = $format;
    }
984912
public static function DateTime ($value, $format) {
		try {
			return (new \DateTime($value))->format($format) === $value;
		} catch (\Exception $e) {
			return false;
		}
	}
268235
public function first($field,$format='') {
      if ($format) {
         @$this->fails["messages"][$field][0] = str_replace(':message', @$this->fails["messages"][$field][0], $format);
      }
      return @$this->fails["messages"][$field][0]?@$this->fails["messages"][$field][0]:'';
   }
203700
public function assertStringEndsWith($suffix, $message = '')
    {
        Assert::assertStringEndsWith($suffix, $this->getData(), $message);

        return $this;
    }
1296220
public function assertNotSameSize($expected, $message = '')
    {
        Assert::assertNotSameSize($expected, $this->getData(), $message);

        return $this;
    }
750669
public function setFieldKeyFormat($format)
    {
        $this->validator->isFormatValid($format);
        $this->fieldKeyFormat = $format;
        return $this;
    }
439239
public static function validate($format, $timeString)
	{
		$time = DateTime::createFromFormat($format, $timeString);

		return ($time !== FALSE) && ($timeString === $time->format($format));
	}
653170
public static function validateDateFormat($format)
    {
        $format = str_replace(array_keys(static::$_map['date']), '', $format); // remove placeholders
        $format = preg_replace("/'(.*)'/", '', $format); // remove literals
        $format = preg_replace('/[^a-z]/i', '', $format);
        $format = trim($format);

        return empty($format);
    }
684439
public function message(string $message)
    {
        $this->_validations[\count($this->_validations) - 1]['message'] = $message;

        return $this;
    }