Code Duplication    Length = 19-19 lines in 2 locations

src/model/Article.php 1 location

@@ 118-136 (lines=19) @@
115
     *
116
     * @throws Exception
117
     */
118
    public function getUrl($method, array $params = [])
119
    {
120
        switch ($method) {
121
            case 'get':
122
                return [
123
                    'url' => vsprintf('/1.0/resource/journal/article/get/%d', $params),
124
                    'method' => 'GET',
125
                    'code' => 200
126
                ];
127
            case 'text':
128
                return [
129
                    'url' => vsprintf('/1.0/resource/journal/article/text/%d', $params),
130
                    'method' => 'GET',
131
                    'code' => 200
132
                ];
133
            default:
134
                throw new Exception('Route for ' . $method . ' not found');
135
        }
136
    }
137
}

src/model/Book.php 1 location

@@ 168-186 (lines=19) @@
165
     *
166
     * @throws Exception
167
     */
168
    public function getUrl($method, array $params = [])
169
    {
170
        switch ($method) {
171
            case 'get':
172
                return [
173
                    'url' => vsprintf('/1.0/resource/book/get/%d', $params),
174
                    'method' => 'GET',
175
                    'code' => 200
176
                ];
177
            case 'text':
178
                return [
179
                    'url' => vsprintf('/1.0/resource/book/text/%d', $params),
180
                    'method' => 'GET',
181
                    'code' => 200
182
                ];
183
            default:
184
                throw new Exception('Route for ' . $method . ' not found');
185
        }
186
    }
187
}