Code Duplication    Length = 19-19 lines in 2 locations

src/model/Article.php 1 location

@@ 82-100 (lines=19) @@
79
     *
80
     * @throws Exception
81
     */
82
    public function getUrl($method, array $params = [])
83
    {
84
        switch ($method) {
85
            case 'get':
86
                return [
87
                    'url' => vsprintf('/1.0/resource/journal/article/get/%d', $params),
88
                    'method' => 'GET',
89
                    'code' => 200
90
                ];
91
            case 'text':
92
                return [
93
                    'url' => vsprintf('/1.0/resource/journal/article/text/%d', $params),
94
                    'method' => 'GET',
95
                    'code' => 200
96
                ];
97
            default:
98
                throw new Exception('Route for ' . $method . ' not found');
99
        }
100
    }
101
102
    /**
103
     * Получение текстов статьи

src/model/Book.php 1 location

@@ 126-144 (lines=19) @@
123
     *
124
     * @throws Exception
125
     */
126
    public function getUrl($method, array $params = [])
127
    {
128
        switch ($method) {
129
            case 'get':
130
                return [
131
                    'url' => vsprintf('/1.0/resource/book/get/%d', $params),
132
                    'method' => 'GET',
133
                    'code' => 200
134
                ];
135
            case 'text':
136
                return [
137
                    'url' => vsprintf('/1.0/resource/book/text/%d', $params),
138
                    'method' => 'GET',
139
                    'code' => 200
140
                ];
141
            default:
142
                throw new Exception('Route for ' . $method . ' not found');
143
        }
144
    }
145
146
    /**
147
     * Получение текстов книги