Code Duplication    Length = 13-14 lines in 3 locations

src/BenatEspina/StackExchangeApiClient/Model/AccountMerge.php 1 location

@@ 46-59 (lines=14) @@
43
        return $instance;
44
    }
45
46
    public static function fromJson(array $data)
47
    {
48
        $instance = new self();
49
        $instance
50
            ->setMergeDate(
51
                array_key_exists('merge_date', $data)
52
                    ? new \DateTimeImmutable('@' . $data['merge_date'])
53
                    : null
54
            )
55
            ->setNewAccountId(array_key_exists('new_account_id', $data) ? $data['new_account_id'] : null)
56
            ->setOldAccountId(array_key_exists('old_account_id', $data) ? $data['old_account_id'] : null);
57
58
        return $instance;
59
    }
60
61
    public function setMergeDate(\DateTimeInterface $mergeDate = null)
62
    {

src/BenatEspina/StackExchangeApiClient/Model/MigrationInfo.php 1 location

@@ 46-59 (lines=14) @@
43
        return $instance;
44
    }
45
46
    public static function fromJson(array $data)
47
    {
48
        $instance = new self();
49
        $instance
50
            ->setOnDate(
51
                array_key_exists('on_date', $data)
52
                    ? new \DateTimeImmutable('@' . $data['on_date'])
53
                    : null
54
            )
55
            ->setOtherSite(array_key_exists('other_site', $data) ? $data['other_site'] : null)
56
            ->setQuestionId(array_key_exists('question_id', $data) ? $data['question_id'] : null);
57
58
        return $instance;
59
    }
60
61
    public function setOnDate(\DateTimeInterface $onDate = null)
62
    {

src/BenatEspina/StackExchangeApiClient/Model/Notice.php 1 location

@@ 35-47 (lines=13) @@
32
    protected $creationDate;
33
    protected $ownerUserId;
34
35
    public static function fromJson(array $data)
36
    {
37
        $instance = new self();
38
        $instance
39
            ->setBody(array_key_exists('body', $data) ? $data['body'] : null)
40
            ->setCreationDate(array_key_exists('creation_date', $data)
41
                ? new \DateTimeImmutable('@' . $data['creation_date'])
42
                : null
43
            )
44
            ->setOwnerUserId(array_key_exists('owner_user_id', $data) ? $data['owner_user_id'] : null);
45
46
        return $instance;
47
    }
48
49
    public static function fromProperties($body, \DateTimeInterface $creationDate, $ownerUserId)
50
    {