Code Duplication    Length = 11-11 lines in 4 locations

src/Apps.php 3 locations

@@ 55-65 (lines=11) @@
52
     *
53
     * @param array $data Application data
54
     */
55
    public function add(array $data): array
56
    {
57
        $resolvedData = $this->resolverFactory->createAppResolver()->resolve($data);
58
59
        $request = $this->createRequest('POST', '/apps');
60
        $request = $request->withHeader('Authorization', "Basic {$this->client->getConfig()->getUserAuthKey()}");
61
        $request = $request->withHeader('Content-Type', 'application/json');
62
        $request = $request->withBody($this->createStream($resolvedData));
63
64
        return $this->client->sendRequest($request);
65
    }
66
67
    /**
68
     * Update application with provided data.
@@ 75-85 (lines=11) @@
72
     * @param string $id   ID of your application
73
     * @param array  $data New application data
74
     */
75
    public function update(string $id, array $data): array
76
    {
77
        $resolvedData = $this->resolverFactory->createAppResolver()->resolve($data);
78
79
        $request = $this->createRequest('PUT', "/apps/$id");
80
        $request = $request->withHeader('Authorization', "Basic {$this->client->getConfig()->getUserAuthKey()}");
81
        $request = $request->withHeader('Content-Type', 'application/json');
82
        $request = $request->withBody($this->createStream($resolvedData));
83
84
        return $this->client->sendRequest($request);
85
    }
86
87
    /**
88
     * Create a new segment for application with provided data.
@@ 93-103 (lines=11) @@
90
     * @param string $appId ID of your application
91
     * @param array  $data  Segment Data
92
     */
93
    public function createSegment($appId, array $data): array
94
    {
95
        $resolvedData = $this->resolverFactory->createSegmentResolver()->resolve($data);
96
97
        $request = $this->createRequest('POST', "/apps/$appId/segments");
98
        $request = $request->withHeader('Authorization', "Basic {$this->client->getConfig()->getApplicationAuthKey()}");
99
        $request = $request->withHeader('Content-Type', 'application/json');
100
        $request = $request->withBody($this->createStream($resolvedData));
101
102
        return $this->client->sendRequest($request);
103
    }
104
105
    /**
106
     * Delete existing segment from your application.

src/Notifications.php 1 location

@@ 81-91 (lines=11) @@
78
     *
79
     * Application authentication key and ID must be set.
80
     */
81
    public function add(array $data): array
82
    {
83
        $resolvedData = $this->resolverFactory->createNotificationResolver()->resolve($data);
84
85
        $request = $this->createRequest('POST', '/notifications');
86
        $request = $request->withHeader('Authorization', "Basic {$this->client->getConfig()->getApplicationAuthKey()}");
87
        $request = $request->withHeader('Content-Type', 'application/json');
88
        $request = $request->withBody($this->createStream($resolvedData));
89
90
        return $this->client->sendRequest($request);
91
    }
92
93
    /**
94
     * Open notification.