MemberFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
c 2
b 0
f 0
dl 0
loc 20
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A entity() 0 11 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Polidog\Chatwork\Entity\Factory;
6
7
use Polidog\Chatwork\Entity\Collection\MemberCollection;
8
use Polidog\Chatwork\Entity\Member;
9
10
class MemberFactory extends AbstractFactory
11
{
12
    protected $collectionName = MemberCollection::class;
13
14
    /**
15
     * @param array $data
16
     *
17
     * @return Member
18
     */
19
    public function entity(array $data = [])
20
    {
21
        $member = new Member();
22
        $member->role = $data['role'];
23
        unset($data['role']);
24
25
        // @todo ここでFactoryオブジェクトを生成するのをなんとかしたい...
26
        $userFactory = new UserFactory();
27
        $member->account = $userFactory->entity($data);
28
29
        return $member;
30
    }
31
}
32