Assert that string has a given length.
/** * isEmpty. * * @return bool */ public function isEmpty() { try { Assertion::length($this->value, 0); return true; } catch (AssertionInvalidArgumentException $exception) { return false; } }
public function testLengthValidForGivenEncoding() { Assertion::length("址", 1, null, null, 'utf8'); }
/** * Validate EAN: * length = 13 * @param string $ean */ public static function ean($ean) { Assert::length($ean, 13); }