647. Class

647.1. Zend\Validator\File\Count

Validator for counting all given files

647.1.1. Methods

647.1.1.1. __construct

__construct()

Sets validator options

Min limits the file count, when used with max=null it is the maximum file count It also accepts an array with the keys ‘min’ and ‘max’

If $options is a integer, it will be used as maximum file count As Array is accepts the following keys: ‘min’: Minimum filecount ‘max’: Maximum filecount

Parameters:integer|array|Traversable – Options for the adapter

647.1.1.2. getMin

getMin()

Returns the minimum file count

Return type:integer

647.1.1.3. setMin

setMin()

Sets the minimum file count

Parameters:integer|array – The minimum file count
Return type:Count Provides a fluent interface
Throws :ExceptionInvalidArgumentException When min is greater than max

647.1.1.4. getMax

getMax()

Returns the maximum file count

Return type:integer

647.1.1.5. setMax

setMax()

Sets the maximum file count

Parameters:integer|array – The maximum file count
Return type:Count Provides a fluent interface
Throws :ExceptionInvalidArgumentException When max is smaller than min

647.1.1.6. addFile

addFile()

Adds a file for validation

Parameters:string|array
Return type:Count

647.1.1.7. isValid

isValid()

Returns true if and only if the file count of all checked files is at least min and not bigger than max (when max is not null). Attention: When checking with set min you must give all files with the first call, otherwise you will get an false.

Parameters:
  • string|array – Filenames to check for count
  • array – File data from ZendFileTransferTransfer
Return type:

bool

647.1.1.8. throwError

throwError()

Throws an error of the given type

Parameters:
  • string
  • string
Return type:

false

647.1.2. Constants

647.1.2.1. TOO_MANY

647.1.2.2. TOO_FEW