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 = array())
119
    {
120
        switch ($method) {
121
            case 'get':
122
                return array(
123
                    'url' => vsprintf('/1.0/resource/journal/article/get/%d', $params),
124
                    'method' => 'GET',
125
                    'code' => 200
126
                );
127
            case 'text':
128
                return array(
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

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