Completed
Push — master ( 79d213...eeff33 )
by Kamil
23:15
created

ThemeAuthorFactory   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B createFromArray() 0 12 5
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Bundle\ThemeBundle\Factory;
13
14
use Sylius\Bundle\ThemeBundle\Model\ThemeAuthor;
15
16
/**
17
 * @author Kamil Kokot <[email protected]>
18
 */
19
final class ThemeAuthorFactory implements ThemeAuthorFactoryInterface
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function createFromArray(array $data)
25
    {
26
        /** @var ThemeAuthor $author */
27
        $author = new ThemeAuthor();
28
29
        $author->setName(isset($data['name']) ? $data['name'] : null);
30
        $author->setEmail(isset($data['email']) ? $data['email'] : null);
31
        $author->setHomepage(isset($data['homepage']) ? $data['homepage'] : null);
32
        $author->setRole(isset($data['role']) ? $data['role'] : null);
33
34
        return $author;
35
    }
36
}
37