mirror of
https://github.com/bdnugget/magento2.git
synced 2026-11-07 17:27:36 +00:00
Fix potential issues when no items in array Convert all array_merge into single format
41 lines
778 B
PHP
41 lines
778 B
PHP
<?php
|
|
/**
|
|
* Copyright © Magento, Inc. All rights reserved.
|
|
* See COPYING.txt for license details.
|
|
*/
|
|
|
|
namespace Magento\Customer\Model\Address;
|
|
|
|
/**
|
|
* Address composite validator.
|
|
*/
|
|
class CompositeValidator implements ValidatorInterface
|
|
{
|
|
/**
|
|
* @var ValidatorInterface[]
|
|
*/
|
|
private $validators;
|
|
|
|
/**
|
|
* @param array $validators
|
|
*/
|
|
public function __construct(
|
|
array $validators = []
|
|
) {
|
|
$this->validators = $validators;
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function validate(AbstractAddress $address)
|
|
{
|
|
$errors = [];
|
|
foreach ($this->validators as $validator) {
|
|
$errors[] = $validator->validate($address);
|
|
}
|
|
|
|
return array_merge([], ...$errors);
|
|
}
|
|
}
|