Completed
Push — master ( ce1278...2488b5 )
by Nate
05:22 queued 04:08
created

Collection::setErrors()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 0
cts 7
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 6
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://github.com/flipbox/salesforce/blob/master/LICENSE.md
6
 * @link       https://github.com/flipbox/salesforce
7
 */
8
9
namespace Flipbox\Salesforce\Collections;
10
11
use Flipbox\Skeleton\Collections\Collection as BaseCollection;
12
use Flipbox\Skeleton\Error\ErrorInterface;
13
use Flipbox\Skeleton\Error\ErrorTrait;
14
15
/**
16
 * @author Flipbox Factory <[email protected]>
17
 * @since 2.1.0
18
 */
19
class Collection extends BaseCollection implements ErrorInterface
20
{
21
    use ErrorTrait;
22
23
    /**
24
     * Errors may be transformed and passed in the constructor config
25
     *
26
     * @param array $errors
27
     * @return $this
28
     */
29
    public function setErrors(array $errors)
30
    {
31
        foreach ($errors as $key => $error) {
32
            $this->addError($key, $error);
33
        }
34
        return $this;
35
    }
36
}
37