protected function validateArray(&$value, array $field, Validation $validation) {
        $validType = true;

        if (!is_array($value) || (count($value) > 0 && !array_key_exists(0, $value))) {
            $validType = false;
        } else {
            // Cast the items into a proper numeric array.
            $value = array_values($value);

            if (isset($field['items'])) {
                // Validate each of the types.
                $path = array_select(['path', 'name'], $field);
                $itemField = $field['items'];
                $itemField['validatorName'] = array_select(['validatorName', 'path', 'name'], $field).'.items';
                foreach ($value as $i => &$item) {
                    $itemField['path'] = "$path.$i";
                    $this->validateField($item, $itemField, $validation);
                }
            }
        }
        return $validType;
    }
protected function validateArray(&$value, array $field, Validation $validation) {
        $validType = true;

        if (!is_array($value) || (count($value) > 0 && !array_key_exists(0, $value))) {
            $validType = false;
        } else {
            // Cast the items into a proper numeric array.
            $value = array_values($value);

            if (isset($field['items'])) {
                // Validate each of the types.
                $path = array_select(['path', 'name'], $field);
                $itemField = $field['items'];
                $itemField['validatorName'] = array_select(['validatorName', 'path', 'name'], $field).'.items';
                foreach ($value as $i => &$item) {
                    $itemField['path'] = "$path.$i";
                    $this->validateField($item, $itemField, $validation);
                }
            }
        }
        return $validType;
    }
protected function validateArray ( & $ value , array $ field , Validation $ validation ) { $ validType = true ; if ( ! is_array ( $ value ) || ( count ( $ value ) > 0 && ! array_key_exists ( 0 , $ value ) ) ) { $ validType = false ; } else { // Cast the items into a proper numeric array. $ value = array_values ( $ value ) ; if ( isset ( $ field [ 'items' ] ) ) { // Validate each of the types. $ path = array_select ( [ 'path' , 'name' ] , $ field ) ; $ itemField = $ field [ 'items' ] ; $ itemField [ 'validatorName' ] = array_select ( [ 'validatorName' , 'path' , 'name' ] , $ field ) . '.items' ; foreach ( $ value as $ i => & $ item ) { $ itemField [ 'path' ] = "$path.$i" ; $ this -> validateField ( $ item , $ itemField , $ validation ) ; } } } return $ validType ; }
Validate an array.

@param mixed &$value The value to validate.
@param array $field The field definition.
@param Validation $validation The validation results to add.
@return bool Returns true if {@link $value} is valid or false otherwise.
Validate an array .