Code Duplication    Length = 7-9 lines in 2 locations

src/Resource/MoipResource.php 2 locations

@@ 92-100 (lines=9) @@
89
     * @param stdClass|null $data
90
     * @return \DateTime|null
91
     */
92
    protected function getIfSetDate($key, stdClass $data = null){
93
94
        $val = $this->getIfSet($key, $data);
95
        if(!empty($val)){
96
            return \DateTime::createFromFormat('Y-m-d', $val);
97
        }
98
        return null;
99
100
    }
101
102
    /**
103
     * Get a key representing a datetime (\Datetime::ATOM), of an object if it exists.
@@ 109-115 (lines=7) @@
106
     * @return \DateTime|null
107
     */
108
109
    protected function getIfSetDateTime($key, stdClass $data = null){
110
        $val = $this->getIfSet($key, $data);
111
        if(!empty($val)){
112
            return \DateTime::createFromFormat(\DateTime::ATOM, $val);
113
        }
114
        return null;
115
    }
116
117
    /**
118
     * Specify data which should be serialized to JSON.