Completed
Push — develop ( 6cec8f...ae3a0e )
by Nate
05:35
created

InterpretUpsertResponseErrors::normalizeErrors()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 0
cts 11
cp 0
rs 9.8333
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 6
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://github.com/flipbox/hubspot/blob/master/LICENSE.md
6
 * @link       https://github.com/flipbox/hubspot
7
 */
8
9
namespace flipbox\craft\hubspot\transformers;
10
11
/**
12
 * @author Flipbox Factory <[email protected]>
13
 * @since 1.0.0
14
 */
15
class InterpretUpsertResponseErrors extends InterpretResponseErrors
16
{
17
    use UpsertErrorInterpreterTrait;
18
19
    /**
20
     * @param array $errors
21
     * @return array
22
     */
23
    public function normalizeErrors(array $errors): array
24
    {
25
        $preparedErrors = parent::normalizeErrors($errors);
26
27
        if (!empty($errors['validationResults'])) {
28
            $preparedErrors = array_merge(
29
                $preparedErrors,
30
                $this->prepareValidationErrors($errors['validationResults'])
31
            );
32
        }
33
34
        return $preparedErrors;
35
    }
36
}
37