Completed
Pull Request — develop (#14)
by Daniel
05:38 queued 01:18
created

Admin   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 1
dl 0
loc 18
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 10 2
1
<?php
2
3
namespace Magefix\Fixture\Builder;
4
5
use Mage;
6
use Magefix\Exceptions\UndefinedAttributes;
7
8
/**
9
 * Class Admin
10
 *
11
 * @package Magefix\Fixture\Builder
12
 * @author  Daniel Kidanemariam <[email protected]>
13
 */
14
class Admin extends AbstractBuilder
15
{
16
    /**
17
     * @return int
18
     * @throws \Exception
19
     *
20
     */
21
    public function build()
22
    {
23
        $this->iterateFixture();
24
        $defaultData = $this->_getMageModelData() ? $this->_getMageModelData() : [];
25
        $mergedData = array_merge($defaultData, $this->_getFixtureAttributes());
26
27
        $this->_getMageModel()->setData($mergedData);
28
29
        return $this->_saveFixture();
30
    }
31
}
32