Code Duplication    Length = 10-10 lines in 5 locations

src/Traits/WooCommerceTrait.php 5 locations

@@ 16-25 (lines=10) @@
13
     *
14
     * @return array
15
     */
16
    public function all($endpoint = '', $options = [])
17
    {
18
        try {
19
            self::__construct();
20
21
            return $this->client->get($endpoint, $options);
22
        } catch (\Exception $e) {
23
            throw new \Exception($e->getMessage(), 1);
24
        }
25
    }
26
27
    /**
28
     * GET method.
@@ 36-45 (lines=10) @@
33
     *
34
     * @return array
35
     */
36
    public function find($endpoint = '', $options = [])
37
    {
38
        try {
39
            self::__construct();
40
41
            return $this->client->get($endpoint, $options);
42
        } catch (\Exception $e) {
43
            throw new \Exception($e->getMessage(), 1);
44
        }
45
    }
46
47
    /**
48
     * POST method.
@@ 56-65 (lines=10) @@
53
     *
54
     * @return array
55
     */
56
    public function create($endpoint, $data)
57
    {
58
        try {
59
            self::__construct();
60
61
            return $this->client->post($endpoint, $data);
62
        } catch (\Exception $e) {
63
            throw new \Exception($e->getMessage(), 1);
64
        }
65
    }
66
67
    /**
68
     * PUT method.
@@ 76-85 (lines=10) @@
73
     *
74
     * @return array
75
     */
76
    public function update($endpoint, $data)
77
    {
78
        try {
79
            self::__construct();
80
81
            return $this->client->put($endpoint, $data);
82
        } catch (\Exception $e) {
83
            throw new \Exception($e->getMessage(), 1);
84
        }
85
    }
86
87
    /**
88
     * DELETE method.
@@ 96-105 (lines=10) @@
93
     *
94
     * @return array
95
     */
96
    public function delete($endpoint, $options = [])
97
    {
98
        try {
99
            self::__construct();
100
101
            return $this->client->delete($endpoint, $options);
102
        } catch (\Exception $e) {
103
            throw new \Exception($e->getMessage(), 1);
104
        }
105
    }
106
107
    /**
108
     * Return the last request header.