Completed
Push — 3.x ( e32815...7c4255 )
by Ryota
10:41 queued 09:27
created

IncomingRequestsFactory::entity()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
dl 10
loc 10
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Polidog\Chatwork\Entity\Factory;
6
7
use Cake\Utility\Inflector;
8
use Polidog\Chatwork\Entity\IncomingRequest;
9
10 View Code Duplication
class IncomingRequestsFactory extends AbstractFactory
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
    /**
13
     * @param array $data
14
     *
15
     * @return IncomingRequest
16
     */
17
    public function entity(array $data = [])
18
    {
19
        $incomingRequest = new IncomingRequest();
20
        foreach ($data as $key => $value) {
21
            $property = Inflector::variable($key);
22
            $incomingRequest->$property = $value;
23
        }
24
25
        return $incomingRequest;
26
    }
27
}
28