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

InterpretUpsertResponseErrors   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 22
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A normalizeErrors() 0 13 2
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