Validate/StringLength.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Validate  
Version
$Id$  

\Zend_Validate_StringLength

Package: Zend_Validate
Parent(s)
\Zend_Validate_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

>VConstant  INVALID = 'stringLengthInvalid'
>VConstant  TOO_SHORT = 'stringLengthTooShort'
>VConstant  TOO_LONG = 'stringLengthTooLong'

Properties

>VPropertyprotectedstring|null $_encoding
Encoding to use
Details
Type
string | null
>VPropertyprotectedinteger|null $_max
Maximum length
If null, there is no maximum length
Details
Type
integer | null
>VPropertyprotectedarray $_messageTemplates = array(self::INVALID => "Invalid type given. String expected", self::TOO_SHORT => "'%value%' is less than %min% characters long", self::TOO_LONG => "'%value%' is more than %max% characters long")
Default valuearray(self::INVALID => "Invalid type given. String expected", self::TOO_SHORT => "'%value%' is less than %min% characters long", self::TOO_LONG => "'%value%' is more than %max% characters long")Details
Type
array
>VPropertyprotectedarray $_messageVariables = array('min' => '_min', 'max' => '_max')
Default valuearray('min' => '_min', 'max' => '_max')Details
Type
array
>VPropertyprotectedinteger $_min
Minimum length
Details
Type
integer

Methods

methodpublic__construct(integer | array | \Zend_Config $options = array()) : void

Sets validator options

Parameters
NameTypeDescription
$optionsinteger | array | \Zend_Config
methodpublicgetEncoding() : string

Returns the actual encoding

Returns
TypeDescription
string
methodpublicgetMax() : integer | null

Returns the max option

Returns
TypeDescription
integer | null
methodpublicgetMin() : integer

Returns the min option

Returns
TypeDescription
integer
methodpublicisValid(string $value) : boolean

Defined by Zend_Validate_Interface

Returns true if and only if the string length of $value is at least the min option and no greater than the max option (when the max option is not null).
Parameters
NameTypeDescription
$valuestring
Returns
TypeDescription
boolean
methodpublicsetEncoding(string $encoding = null) : \Zend_Validate_StringLength

Sets a new encoding to use

Parameters
NameTypeDescription
$encodingstring
Returns
TypeDescription
\Zend_Validate_StringLength
methodpublicsetMax(integer | null $max) : \Zend_Validate_StringLength

Sets the max option

Parameters
NameTypeDescription
$maxinteger | null
Returns
TypeDescription
\Zend_Validate_StringLengthProvides a fluent interface
Throws
ExceptionDescription
\Zend_Validate_Exception
methodpublicsetMin(integer $min) : \Zend_Validate_StringLength

Sets the min option

Parameters
NameTypeDescription
$mininteger
Returns
TypeDescription
\Zend_Validate_StringLengthProvides a fluent interface
Throws
ExceptionDescription
\Zend_Validate_Exception
Documentation was generated by phpDocumentor 2.2.0 .