Code Duplication    Length = 20-20 lines in 2 locations

src/Users/ContactInfo.php 2 locations

@@ 101-120 (lines=20) @@
98
     * 
99
     * @return Phone
100
     */
101
    public function addPhone($phone_number, $phone_type, $preferred = false)
102
    {
103
        if (!$this->data->phone) {
104
            $this->data->phone = [];
105
        }
106
        if ($preferred) {
107
            $this->unsetPreferredPhone();
108
        }
109
        $phone_obj = (object) [
110
            'phone_number' => $phone_number,
111
            'preferred' => $preferred,
112
            'preferred_sms' => false,
113
            'segment_type' => 'Internal',
114
            'phone_type' => [(object) [
115
                'value' => $phone_type
116
            ]]
117
        ];
118
        $this->data->phone[] = $phone_obj;
119
        return Phone::make($this->client, $phone_obj);
120
    }
121
122
    /**
123
     * Gets the user's preferred phone number, or null if none are preferred
@@ 263-282 (lines=20) @@
260
     * 
261
     * @return Email
262
     */
263
    public function addEmail($email_address, $email_type = 'personal', $preferred = false)
264
    {
265
        if (!$this->data->email) {
266
            $this->data->email = [];
267
        }
268
        if ($preferred) {
269
            $this->unsetEmail();
270
        }
271
        $email_obj = (object) [
272
            'preferred' => $preferred,
273
            'segment_type' => 'Internal',
274
            'email_address' => $email_address,
275
            'description' => '',
276
            'email_type' =>[(object) [
277
                'value' => $email_type,
278
            ]]
279
        ];
280
        $this->data->email[] = $email_obj;
281
        return Email::make($this->client, $email_obj);
282
    }
283
284
    /**
285
     * Removes the given email address from the user