Code Duplication    Length = 18-18 lines in 4 locations

src/Entity/Factory/IncomingRequestsFactory.php 1 location

@@ 10-27 (lines=18) @@
7
use Cake\Utility\Inflector;
8
use Polidog\Chatwork\Entity\IncomingRequest;
9
10
class IncomingRequestsFactory extends AbstractFactory
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

src/Entity/Factory/RoomFactory.php 1 location

@@ 10-27 (lines=18) @@
7
use Cake\Utility\Inflector;
8
use Polidog\Chatwork\Entity\Room;
9
10
class RoomFactory extends AbstractFactory
11
{
12
    /**
13
     * @param array $data
14
     *
15
     * @return Room
16
     */
17
    public function entity(array $data = [])
18
    {
19
        $room = new Room();
20
        foreach ($data as $key => $value) {
21
            $property = Inflector::variable($key);
22
            $room->$property = $value;
23
        }
24
25
        return $room;
26
    }
27
}
28

src/Entity/Factory/StatusFactory.php 1 location

@@ 10-27 (lines=18) @@
7
use Cake\Utility\Inflector;
8
use Polidog\Chatwork\Entity\Status;
9
10
class StatusFactory extends AbstractFactory
11
{
12
    /**
13
     * @param array $data
14
     *
15
     * @return Status
16
     */
17
    public function entity(array $data = [])
18
    {
19
        $status = new Status();
20
        foreach ($data as $key => $value) {
21
            $property = Inflector::variable($key);
22
            $status->$property = $value;
23
        }
24
25
        return $status;
26
    }
27
}
28

src/Entity/Factory/UserFactory.php 1 location

@@ 10-27 (lines=18) @@
7
use Cake\Utility\Inflector;
8
use Polidog\Chatwork\Entity\User;
9
10
class UserFactory extends AbstractFactory
11
{
12
    /**
13
     * @param array $data
14
     *
15
     * @return User
16
     */
17
    public function entity(array $data = [])
18
    {
19
        $user = new User();
20
        foreach ($data as $key => $value) {
21
            $property = Inflector::variable($key);
22
            $user->$property = $value;
23
        }
24
25
        return $user;
26
    }
27
}
28