Overview

Namespaces

  • None
  • Wei
    • Validator

Classes

  • All
  • AllOf
  • Alnum
  • Alpha
  • BaseValidator
  • Between
  • Blank
  • Callback
  • CharLength
  • Chinese
  • Color
  • Contains
  • CreditCard
  • Date
  • DateTime
  • Decimal
  • Digit
  • Dir
  • DivisibleBy
  • DoubleByte
  • Email
  • EndsWith
  • EqualTo
  • Exists
  • FieldExists
  • File
  • GreaterThan
  • GreaterThanOrEqual
  • IdCardCn
  • IdCardHk
  • IdCardMo
  • IdCardTw
  • IdenticalTo
  • Image
  • In
  • Ip
  • Length
  • LessThan
  • LessThanOrEqual
  • Lowercase
  • Luhn
  • MaxLength
  • MinLength
  • MobileCn
  • NaturalNumber
  • NoneOf
  • Null
  • Number
  • OneOf
  • Password
  • Phone
  • PhoneCn
  • PlateNumberCn
  • PositiveInteger
  • PostcodeCn
  • Present
  • QQ
  • RecordExists
  • Regex
  • Required
  • SomeOf
  • StartsWith
  • Time
  • Tld
  • Type
  • Uppercase
  • Url
  • Uuid
  • Overview
  • Namespace
  • Class

Class Length

Check if the length (or size) of input is equals specified length or in specified length range

Wei\Base
Extended by Wei\Validator\BaseValidator
Extended by Wei\Validator\Length

Direct known subclasses

Wei\Validator\CharLength, Wei\Validator\MaxLength, Wei\Validator\MinLength
Namespace: Wei\Validator
Author: Twin Huang twinhuang@qq.com
Located at Validator/Length.php
Methods summary
public boolean
# __invoke( mixed $input, $min = null, $max = null )

Validate the input value

Validate the input value

Parameters

$input
$min
$max

Returns

boolean

Overrides

Wei\Validator\BaseValidator::__invoke()
protected boolean
# doValidate( mixed $input )

Validate the input value (ignore the $negative property)

Validate the input value (ignore the $negative property)

Parameters

$input
The input to be validated

Returns

boolean
public integer|false
# getLength( string|array|Countable $input )

Return the input's length or false when could not detected

Return the input's length or false when could not detected

Parameters

$input

Returns

integer|false
Methods inherited from Wei\Validator\BaseValidator
addError(), getErrors(), getFirstMessage(), getJoinedMessage(), getMessages(), getName(), hasError(), isString(), isValid(), loadTranslationMessages(), setMessages(), setName(), storeOption()
Methods inherited from Wei\Base
__call(), __construct(), __get(), getOption(), setOption()
Magic methods inherited from Wei\Validator\BaseValidator
t()
Properties summary
protected string $notDetectedMessage
# '%name%\'s length could not be detected'
protected string $lengthMessage
# '%name% must have a length of %length%'
protected string $lengthItemMessage
# '%name% must contain %length% item(s)'
protected string $notInMessage
# '%name% must have a length between %min% and %max%'
protected string $notInItemMessage
# '%name% must contain %min% to %max% item(s)'
protected $min
#
protected $max
#
protected integer $length

The required exactly length of input

The required exactly length of input

#
protected boolean $countByChars

Whether count the string length by characters or bytes

Whether count the string length by characters or bytes

# false
protected string $charset

The character encoding

The character encoding

# 'UTF-8'
Properties inherited from Wei\Validator\BaseValidator
$errors, $name, $negative, $negativeMessage, $notStringMessage, $validator
Properties inherited from Wei\Base
$providers, $wei
Magic properties inherited from Wei\Validator\BaseValidator
$t
Wei Framework API documentation generated by ApiGen