Code Duplication    Length = 7-9 lines in 13 locations

src/Resources/Companies.php 2 locations

@@ 16-22 (lines=7) @@
13
     *
14
     * @return \SevenShores\Hubspot\Http\Response
15
     */
16
    function create($properties)
17
    {
18
        $endpoint = 'https://api.hubapi.com/companies/v2/companies/';
19
        $options['json'] = ['properties' => $properties];
20
21
        return $this->client->request('post', $endpoint, $options);
22
    }
23
24
    /**
25
     * Updates a company
@@ 33-39 (lines=7) @@
30
     *
31
     * @return \SevenShores\Hubspot\Http\Response
32
     */
33
    function update($id, $properties)
34
    {
35
        $endpoint = "https://api.hubapi.com/companies/v2/companies/{$id}";
36
        $options['json'] = ['properties' => $properties];
37
38
        return $this->client->request('put', $endpoint, $options);
39
    }
40
41
    /**
42
     * Deletes a company

src/Resources/Contacts.php 3 locations

@@ 26-33 (lines=8) @@
23
     * @param array $properties The contact properties to update.
24
     * @return \SevenShores\Hubspot\Http\Response
25
     */
26
    function update($id, $properties)
27
    {
28
        $endpoint = "https://api.hubapi.com/contacts/v1/contact/vid/{$id}/profile";
29
30
        $options['json'] = ['properties' => $properties];
31
32
        return $this->client->request('post', $endpoint, $options);
33
    }
34
35
    /**
36
     * @param string $email      The contact's email address.
@@ 40-47 (lines=8) @@
37
     * @param array  $properties The contact properties to update.
38
     * @return \SevenShores\Hubspot\Http\Response
39
     */
40
    function updateByEmail($email, $properties)
41
    {
42
        $endpoint = "https://api.hubapi.com/contacts/v1/contact/email/{$email}/profile";
43
44
        $options['json'] = ['properties' => $properties];
45
46
        return $this->client->request('post', $endpoint, $options);
47
    }
48
49
    /**
50
     * @param string $email      The contact's email address.
@@ 54-61 (lines=8) @@
51
     * @param array  $properties The contact properties.
52
     * @return \SevenShores\Hubspot\Http\Response
53
     */
54
    function createOrUpdate($email, $properties = [])
55
    {
56
        $endpoint = "https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/{$email}";
57
58
        $options['json'] = ['properties' => $properties];
59
60
        return $this->client->request('post', $endpoint, $options);
61
    }
62
63
    /**
64
     * @param array $contacts The contacts and properties.

src/Resources/Owners.php 1 location

@@ 28-34 (lines=7) @@
25
     * @param array $properties
26
     * @return \SevenShores\Hubspot\Http\Response
27
     */
28
    function update($id, $properties)
29
    {
30
        $endpoint = "https://api.hubapi.com/owners/v2/owners/{$id}";
31
        $options['json'] = $properties;
32
33
        return $this->client->request('put', $endpoint, $options);
34
    }
35
36
    /**
37
     * @param int $id

src/Resources/DealPipelines.php 1 location

@@ 30-37 (lines=8) @@
27
        return $this->client->request('post', $endpoint, $options);
28
    }
29
30
    public function update($id, array $pipeline)
31
    {
32
        $endpoint = "https://api.hubapi.com/deals/v1/pipelines/{$id}";
33
34
        $options['json'] = $pipeline;
35
36
        return $this->client->request('put', $endpoint, $options);
37
    }
38
39
    public function delete($id)
40
    {

src/Resources/Deals.php 1 location

@@ 27-34 (lines=8) @@
24
     * @param array $deal The deal properties to update.
25
     * @return mixed
26
     */
27
    function update($id, array $deal)
28
    {
29
        $endpoint = "https://api.hubapi.com/deals/v1/deal/{$id}";
30
31
        $options['json'] = $deal;
32
33
        return $this->client->request('put', $endpoint, $options);
34
    }
35
36
    /**
37
     * @param array $params

src/Resources/DealProperties.php 2 locations

@@ 56-64 (lines=9) @@
53
     * @param array  $property
54
     * @return \SevenShores\Hubspot\Http\Response
55
     */
56
    function update($name, $property)
57
    {
58
        $endpoint = "https://api.hubapi.com/deals/v1/properties/named/{$name}";
59
60
        $property['name'] = $name;
61
        $options['json'] = $property;
62
63
        return $this->client->request('put', $endpoint, $options);
64
    }
65
66
    /**
67
     * Delete a deal property.
@@ 117-125 (lines=9) @@
114
     *
115
     * @return \SevenShores\Hubspot\Http\Response
116
     */
117
    function updateGroup($groupName, $group)
118
    {
119
        $endpoint = "https://api.hubapi.com/properties/v1/deals/groups/named/{$groupName}";
120
121
        $group['name'] = $groupName;
122
        $options['json'] = $group;
123
124
        return $this->client->request('put', $endpoint, $options);
125
    }
126
127
    /**
128
     * Delete an existing deal property group.

src/Resources/BlogPosts.php 2 locations

@@ 118-125 (lines=8) @@
115
     * @param  string $name The cloned post name
116
     * @return \SevenShores\Hubspot\Http\Response
117
     */
118
    function clonePost($id, $name)
119
    {
120
        $endpoint = "https://api.hubapi.com/content/api/v2/blog-posts/{$id}/clone";
121
122
        $options['json'] = ['name' => $name];
123
124
        return $this->client->request('post', $endpoint, $options);
125
    }
126
127
    /**
128
     * Determine if the auto-save buffer differs from the live blog post.
@@ 153-160 (lines=8) @@
150
     * @param  string $action The publish action
151
     * @return \SevenShores\Hubspot\Http\Response
152
     */
153
    function publishAction($id, $action)
154
    {
155
        $endpoint = "https://api.hubapi.com/content/api/v2/blog-posts/{$id}/publish-action";
156
157
        $options['json'] = ['action' => $action];
158
159
        return $this->client->request('post', $endpoint, $options);
160
    }
161
162
    /**
163
     * Copies the contents of the auto-save buffer into the live blog post.

src/Resources/CompanyProperties.php 1 location

@@ 113-121 (lines=9) @@
110
     *
111
     * @return \SevenShores\Hubspot\Http\Response
112
     */
113
    function updateGroup($groupName, $group)
114
    {
115
        $endpoint = "https://api.hubapi.com/companies/v2/groups/named/{$groupName}";
116
117
        $group['name'] = $groupName;
118
        $options['json'] = $group;
119
120
        return $this->client->request('put', $endpoint, $options);
121
    }
122
123
    /**
124
     * Delete an existing company property group.