length() публичный статический Метод

Assert that string has a given length.
public static length ( mixed $value, integer $length, string | null $message = null, string | null $propertyPath = null, string $encoding = 'utf8' ) : boolean
$value mixed
$length integer
$message string | null
$propertyPath string | null
$encoding string
Результат boolean
Пример #1
0
 /**
  * isEmpty.
  *
  * @return bool
  */
 public function isEmpty()
 {
     try {
         Assertion::length($this->value, 0);
         return true;
     } catch (AssertionInvalidArgumentException $exception) {
         return false;
     }
 }
Пример #2
0
 public function testLengthValidForGivenEncoding()
 {
     Assertion::length("址", 1, null, null, 'utf8');
 }
Пример #3
0
 /**
  * Validate EAN:
  * length = 13
  * @param string $ean
  */
 public static function ean($ean)
 {
     Assert::length($ean, 13);
 }