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);
 }