Code Duplication    Length = 13-14 lines in 3 locations

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

@@ 36-49 (lines=14) @@
33
        return $instance;
34
    }
35
36
    public static function fromJson(array $data)
37
    {
38
        $instance = new self();
39
        $instance
40
            ->setMergeDate(
41
                array_key_exists('merge_date', $data)
42
                    ? new \DateTimeImmutable('@' . $data['merge_date'])
43
                    : null
44
            )
45
            ->setNewAccountId(array_key_exists('new_account_id', $data) ? $data['new_account_id'] : null)
46
            ->setOldAccountId(array_key_exists('old_account_id', $data) ? $data['old_account_id'] : null);
47
48
        return $instance;
49
    }
50
51
    public function setMergeDate(\DateTimeInterface $mergeDate = null)
52
    {

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

@@ 36-49 (lines=14) @@
33
        return $instance;
34
    }
35
36
    public static function fromJson(array $data)
37
    {
38
        $instance = new self();
39
        $instance
40
            ->setOnDate(
41
                array_key_exists('on_date', $data)
42
                    ? new \DateTimeImmutable('@' . $data['on_date'])
43
                    : null
44
            )
45
            ->setOtherSite(array_key_exists('other_site', $data) ? $data['other_site'] : null)
46
            ->setQuestionId(array_key_exists('question_id', $data) ? $data['question_id'] : null);
47
48
        return $instance;
49
    }
50
51
    public function setOnDate(\DateTimeInterface $onDate = null)
52
    {

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

@@ 25-37 (lines=13) @@
22
    protected $creationDate;
23
    protected $ownerUserId;
24
25
    public static function fromJson(array $data)
26
    {
27
        $instance = new self();
28
        $instance
29
            ->setBody(array_key_exists('body', $data) ? $data['body'] : null)
30
            ->setCreationDate(array_key_exists('creation_date', $data)
31
                ? new \DateTimeImmutable('@' . $data['creation_date'])
32
                : null
33
            )
34
            ->setOwnerUserId(array_key_exists('owner_user_id', $data) ? $data['owner_user_id'] : null);
35
36
        return $instance;
37
    }
38
39
    public static function fromProperties($body, \DateTimeInterface $creationDate, $ownerUserId)
40
    {