Code Duplication    Length = 10-10 lines in 35 locations

eZ/Publish/Core/Persistence/Legacy/Content/ObjectState/Gateway/ExceptionConversion.php 11 locations

@@ 47-56 (lines=10) @@
44
     *
45
     * @return array
46
     */
47
    public function loadObjectStateData($stateId)
48
    {
49
        try {
50
            return $this->innerGateway->loadObjectStateData($stateId);
51
        } catch (DBALException $e) {
52
            throw new RuntimeException('Database error', 0, $e);
53
        } catch (PDOException $e) {
54
            throw new RuntimeException('Database error', 0, $e);
55
        }
56
    }
57
58
    /**
59
     * Loads data for an object state by identifier.
@@ 66-75 (lines=10) @@
63
     *
64
     * @return array
65
     */
66
    public function loadObjectStateDataByIdentifier($identifier, $groupId)
67
    {
68
        try {
69
            return $this->innerGateway->loadObjectStateDataByIdentifier($identifier, $groupId);
70
        } catch (DBALException $e) {
71
            throw new RuntimeException('Database error', 0, $e);
72
        } catch (PDOException $e) {
73
            throw new RuntimeException('Database error', 0, $e);
74
        }
75
    }
76
77
    /**
78
     * Loads data for all object states belonging to group with $groupId ID.
@@ 84-93 (lines=10) @@
81
     *
82
     * @return array
83
     */
84
    public function loadObjectStateListData($groupId)
85
    {
86
        try {
87
            return $this->innerGateway->loadObjectStateListData($groupId);
88
        } catch (DBALException $e) {
89
            throw new RuntimeException('Database error', 0, $e);
90
        } catch (PDOException $e) {
91
            throw new RuntimeException('Database error', 0, $e);
92
        }
93
    }
94
95
    /**
96
     * Loads data for an object state group.
@@ 102-111 (lines=10) @@
99
     *
100
     * @return array
101
     */
102
    public function loadObjectStateGroupData($groupId)
103
    {
104
        try {
105
            return $this->innerGateway->loadObjectStateGroupData($groupId);
106
        } catch (DBALException $e) {
107
            throw new RuntimeException('Database error', 0, $e);
108
        } catch (PDOException $e) {
109
            throw new RuntimeException('Database error', 0, $e);
110
        }
111
    }
112
113
    /**
114
     * Loads data for an object state group by identifier.
@@ 188-197 (lines=10) @@
185
     *
186
     * @param int $stateId
187
     */
188
    public function deleteObjectState($stateId)
189
    {
190
        try {
191
            return $this->innerGateway->deleteObjectState($stateId);
192
        } catch (DBALException $e) {
193
            throw new RuntimeException('Database error', 0, $e);
194
        } catch (PDOException $e) {
195
            throw new RuntimeException('Database error', 0, $e);
196
        }
197
    }
198
199
    /**
200
     * Update object state links from $oldStateId to $newStateId.
@@ 221-230 (lines=10) @@
218
     *
219
     * @param int $stateId
220
     */
221
    public function deleteObjectStateLinks($stateId)
222
    {
223
        try {
224
            return $this->innerGateway->deleteObjectStateLinks($stateId);
225
        } catch (DBALException $e) {
226
            throw new RuntimeException('Database error', 0, $e);
227
        } catch (PDOException $e) {
228
            throw new RuntimeException('Database error', 0, $e);
229
        }
230
    }
231
232
    /**
233
     * Inserts a new object state group into database.
@@ 269-278 (lines=10) @@
266
     *
267
     * @param mixed $groupId
268
     */
269
    public function deleteObjectStateGroup($groupId)
270
    {
271
        try {
272
            return $this->innerGateway->deleteObjectStateGroup($groupId);
273
        } catch (DBALException $e) {
274
            throw new RuntimeException('Database error', 0, $e);
275
        } catch (PDOException $e) {
276
            throw new RuntimeException('Database error', 0, $e);
277
        }
278
    }
279
280
    /**
281
     * Sets the object state $stateId to content with $contentId ID.
@@ 287-296 (lines=10) @@
284
     * @param mixed $groupId
285
     * @param mixed $stateId
286
     */
287
    public function setContentState($contentId, $groupId, $stateId)
288
    {
289
        try {
290
            return $this->innerGateway->setContentState($contentId, $groupId, $stateId);
291
        } catch (DBALException $e) {
292
            throw new RuntimeException('Database error', 0, $e);
293
        } catch (PDOException $e) {
294
            throw new RuntimeException('Database error', 0, $e);
295
        }
296
    }
297
298
    /**
299
     * Loads object state data for $contentId content from $stateGroupId state group.
@@ 306-315 (lines=10) @@
303
     *
304
     * @return array
305
     */
306
    public function loadObjectStateDataForContent($contentId, $stateGroupId)
307
    {
308
        try {
309
            return $this->innerGateway->loadObjectStateDataForContent($contentId, $stateGroupId);
310
        } catch (DBALException $e) {
311
            throw new RuntimeException('Database error', 0, $e);
312
        } catch (PDOException $e) {
313
            throw new RuntimeException('Database error', 0, $e);
314
        }
315
    }
316
317
    /**
318
     * Returns the number of objects which are in this state.
@@ 324-333 (lines=10) @@
321
     *
322
     * @return int
323
     */
324
    public function getContentCount($stateId)
325
    {
326
        try {
327
            return $this->innerGateway->getContentCount($stateId);
328
        } catch (DBALException $e) {
329
            throw new RuntimeException('Database error', 0, $e);
330
        } catch (PDOException $e) {
331
            throw new RuntimeException('Database error', 0, $e);
332
        }
333
    }
334
335
    /**
336
     * Updates the object state priority to provided value.
@@ 341-350 (lines=10) @@
338
     * @param mixed $stateId
339
     * @param int $priority
340
     */
341
    public function updateObjectStatePriority($stateId, $priority)
342
    {
343
        try {
344
            return $this->innerGateway->updateObjectStatePriority($stateId, $priority);
345
        } catch (DBALException $e) {
346
            throw new RuntimeException('Database error', 0, $e);
347
        } catch (PDOException $e) {
348
            throw new RuntimeException('Database error', 0, $e);
349
        }
350
    }
351
}
352

eZ/Publish/Core/Persistence/Legacy/Content/Section/Gateway/ExceptionConversion.php 7 locations

@@ 82-91 (lines=10) @@
79
     *
80
     * @return string[][]
81
     */
82
    public function loadSectionData($id)
83
    {
84
        try {
85
            return $this->innerGateway->loadSectionData($id);
86
        } catch (DBALException $e) {
87
            throw new RuntimeException('Database error', 0, $e);
88
        } catch (PDOException $e) {
89
            throw new RuntimeException('Database error', 0, $e);
90
        }
91
    }
92
93
    /**
94
     * Loads data for all sections.
@@ 98-107 (lines=10) @@
95
     *
96
     * @return string[][]
97
     */
98
    public function loadAllSectionData()
99
    {
100
        try {
101
            return $this->innerGateway->loadAllSectionData();
102
        } catch (DBALException $e) {
103
            throw new RuntimeException('Database error', 0, $e);
104
        } catch (PDOException $e) {
105
            throw new RuntimeException('Database error', 0, $e);
106
        }
107
    }
108
109
    /**
110
     * Loads data for section with $identifier.
@@ 134-143 (lines=10) @@
131
     *
132
     * @return int
133
     */
134
    public function countContentObjectsInSection($id)
135
    {
136
        try {
137
            return $this->innerGateway->countContentObjectsInSection($id);
138
        } catch (DBALException $e) {
139
            throw new RuntimeException('Database error', 0, $e);
140
        } catch (PDOException $e) {
141
            throw new RuntimeException('Database error', 0, $e);
142
        }
143
    }
144
145
    /**
146
     * Counts the number of role policies using section with $id in their limitations.
@@ 152-161 (lines=10) @@
149
     *
150
     * @return int
151
     */
152
    public function countPoliciesUsingSection($id)
153
    {
154
        try {
155
            return $this->innerGateway->countPoliciesUsingSection($id);
156
        } catch (DBALException $e) {
157
            throw new RuntimeException('Database error', 0, $e);
158
        } catch (PDOException $e) {
159
            throw new RuntimeException('Database error', 0, $e);
160
        }
161
    }
162
163
    /**
164
     * Counts the number of role assignments using section with $id in their limitations.
@@ 170-179 (lines=10) @@
167
     *
168
     * @return int
169
     */
170
    public function countRoleAssignmentsUsingSection($id)
171
    {
172
        try {
173
            return $this->innerGateway->countRoleAssignmentsUsingSection($id);
174
        } catch (DBALException $e) {
175
            throw new RuntimeException('Database error', 0, $e);
176
        } catch (PDOException $e) {
177
            throw new RuntimeException('Database error', 0, $e);
178
        }
179
    }
180
181
    /**
182
     * Deletes the Section with $id.
@@ 186-195 (lines=10) @@
183
     *
184
     * @param int $id
185
     */
186
    public function deleteSection($id)
187
    {
188
        try {
189
            return $this->innerGateway->deleteSection($id);
190
        } catch (DBALException $e) {
191
            throw new RuntimeException('Database error', 0, $e);
192
        } catch (PDOException $e) {
193
            throw new RuntimeException('Database error', 0, $e);
194
        }
195
    }
196
197
    /**
198
     * Inserts the assignment of $contentId to $sectionId.
@@ 203-212 (lines=10) @@
200
     * @param int $sectionId
201
     * @param int $contentId
202
     */
203
    public function assignSectionToContent($sectionId, $contentId)
204
    {
205
        try {
206
            return $this->innerGateway->assignSectionToContent($sectionId, $contentId);
207
        } catch (DBALException $e) {
208
            throw new RuntimeException('Database error', 0, $e);
209
        } catch (PDOException $e) {
210
            throw new RuntimeException('Database error', 0, $e);
211
        }
212
    }
213
}
214

eZ/Publish/Core/Persistence/Legacy/Content/UrlWildcard/Gateway/ExceptionConversion.php 1 location

@@ 61-70 (lines=10) @@
58
     *
59
     * @param mixed $id
60
     */
61
    public function deleteUrlWildcard($id)
62
    {
63
        try {
64
            return $this->innerGateway->deleteUrlWildcard($id);
65
        } catch (DBALException $e) {
66
            throw new \RuntimeException('Database error', 0, $e);
67
        } catch (PDOException $e) {
68
            throw new \RuntimeException('Database error', 0, $e);
69
        }
70
    }
71
72
    /**
73
     * @param mixed $parentId

eZ/Publish/Core/Persistence/Legacy/URL/Gateway/ExceptionConversion.php 4 locations

@@ 66-75 (lines=10) @@
63
    /**
64
     * {@inheritdoc}
65
     */
66
    public function findUsages($id)
67
    {
68
        try {
69
            return $this->innerGateway->findUsages($id);
70
        } catch (DBALException $e) {
71
            throw new RuntimeException('Database error', 0, $e);
72
        } catch (PDOException $e) {
73
            throw new RuntimeException('Database error', 0, $e);
74
        }
75
    }
76
77
    /**
78
     * {@inheritdoc}
@@ 80-89 (lines=10) @@
77
    /**
78
     * {@inheritdoc}
79
     */
80
    public function loadUrlData($id)
81
    {
82
        try {
83
            return $this->innerGateway->loadUrlData($id);
84
        } catch (DBALException $e) {
85
            throw new RuntimeException('Database error', 0, $e);
86
        } catch (PDOException $e) {
87
            throw new RuntimeException('Database error', 0, $e);
88
        }
89
    }
90
91
    /**
92
     * {@inheritdoc}
@@ 94-103 (lines=10) @@
91
    /**
92
     * {@inheritdoc}
93
     */
94
    public function loadUrlDataByUrl($url)
95
    {
96
        try {
97
            return $this->innerGateway->loadUrlDataByUrl($url);
98
        } catch (DBALException $e) {
99
            throw new RuntimeException('Database error', 0, $e);
100
        } catch (PDOException $e) {
101
            throw new RuntimeException('Database error', 0, $e);
102
        }
103
    }
104
}
105
@@ 38-47 (lines=10) @@
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function updateUrl(URL $url)
39
    {
40
        try {
41
            return $this->innerGateway->updateUrl($url);
42
        } catch (DBALException $e) {
43
            throw new RuntimeException('Database error', 0, $e);
44
        } catch (PDOException $e) {
45
            throw new RuntimeException('Database error', 0, $e);
46
        }
47
    }
48
49
    /**
50
     * {@inheritdoc}

eZ/Publish/Core/Persistence/Legacy/User/Gateway/ExceptionConversion.php 6 locations

@@ 81-90 (lines=10) @@
78
     *
79
     * @return array
80
     */
81
    public function load($userId)
82
    {
83
        try {
84
            return $this->innerGateway->load($userId);
85
        } catch (DBALException $e) {
86
            throw new RuntimeException('Database error', 0, $e);
87
        } catch (PDOException $e) {
88
            throw new RuntimeException('Database error', 0, $e);
89
        }
90
    }
91
92
    /**
93
     * Loads user with user login.
@@ 135-144 (lines=10) @@
132
     *
133
     * @return array
134
     */
135
    public function loadUserByToken($hash)
136
    {
137
        try {
138
            return $this->innerGateway->loadUserByToken($hash);
139
        } catch (DBALException $e) {
140
            throw new \RuntimeException('Database error', 0, $e);
141
        } catch (\PDOException $e) {
142
            throw new \RuntimeException('Database error', 0, $e);
143
        }
144
    }
145
146
    /**
147
     * Update the user information specified by the user struct.
@@ 183-192 (lines=10) @@
180
     *
181
     * @param string $hash
182
     */
183
    public function expireUserToken($hash)
184
    {
185
        try {
186
            return $this->innerGateway->expireUserToken($hash);
187
        } catch (DBALException $e) {
188
            throw new RuntimeException('Database error', 0, $e);
189
        } catch (PDOException $e) {
190
            throw new RuntimeException('Database error', 0, $e);
191
        }
192
    }
193
194
    /**
195
     * Assigns role to user with given limitation.
@@ 201-210 (lines=10) @@
198
     * @param mixed $roleId
199
     * @param array $limitation
200
     */
201
    public function assignRole($contentId, $roleId, array $limitation)
202
    {
203
        try {
204
            return $this->innerGateway->assignRole($contentId, $roleId, $limitation);
205
        } catch (DBALException $e) {
206
            throw new RuntimeException('Database error', 0, $e);
207
        } catch (PDOException $e) {
208
            throw new RuntimeException('Database error', 0, $e);
209
        }
210
    }
211
212
    /**
213
     * Remove role from user or user group.
@@ 218-227 (lines=10) @@
215
     * @param mixed $contentId
216
     * @param mixed $roleId
217
     */
218
    public function removeRole($contentId, $roleId)
219
    {
220
        try {
221
            return $this->innerGateway->removeRole($contentId, $roleId);
222
        } catch (DBALException $e) {
223
            throw new RuntimeException('Database error', 0, $e);
224
        } catch (PDOException $e) {
225
            throw new RuntimeException('Database error', 0, $e);
226
        }
227
    }
228
229
    /**
230
     * Remove role from user or user group, by assignment ID.
@@ 167-176 (lines=10) @@
164
     *
165
     * @param UserTokenUpdateStruct $userTokenUpdateStruct
166
     */
167
    public function updateUserToken(UserTokenUpdateStruct $userTokenUpdateStruct)
168
    {
169
        try {
170
            return $this->innerGateway->updateUserToken($userTokenUpdateStruct);
171
        } catch (DBALException $e) {
172
            throw new RuntimeException('Database error', 0, $e);
173
        } catch (PDOException $e) {
174
            throw new RuntimeException('Database error', 0, $e);
175
        }
176
    }
177
178
    /**
179
     * Expires user token with user hash.

eZ/Publish/Core/Persistence/Legacy/User/Role/Gateway/ExceptionConversion.php 1 location

@@ 178-187 (lines=10) @@
175
     *
176
     * @return array
177
     */
178
    public function loadRoleAssignmentsByGroupId($groupId, $inherited = false)
179
    {
180
        try {
181
            return $this->innerGateway->loadRoleAssignmentsByGroupId($groupId, $inherited);
182
        } catch (DBALException $e) {
183
            throw new RuntimeException('Database error', 0, $e);
184
        } catch (PDOException $e) {
185
            throw new RuntimeException('Database error', 0, $e);
186
        }
187
    }
188
189
    /**
190
     * Loads role assignments for given role ID.

eZ/Publish/Core/Persistence/Legacy/Content/Language/Gateway/ExceptionConversion.php 5 locations

@@ 76-85 (lines=10) @@
73
    /**
74
     * {@inheritdoc}
75
     */
76
    public function loadLanguageListData(array $ids): iterable
77
    {
78
        try {
79
            return $this->innerGateway->loadLanguageListData($ids);
80
        } catch (DBALException $e) {
81
            throw new RuntimeException('Database error', 0, $e);
82
        } catch (PDOException $e) {
83
            throw new RuntimeException('Database error', 0, $e);
84
        }
85
    }
86
87
    /**
88
     * {@inheritdoc}
@@ 90-99 (lines=10) @@
87
    /**
88
     * {@inheritdoc}
89
     */
90
    public function loadLanguageListDataByLanguageCode(array $languageCodes): iterable
91
    {
92
        try {
93
            return $this->innerGateway->loadLanguageListDataByLanguageCode($languageCodes);
94
        } catch (DBALException $e) {
95
            throw new RuntimeException('Database error', 0, $e);
96
        } catch (PDOException $e) {
97
            throw new RuntimeException('Database error', 0, $e);
98
        }
99
    }
100
101
    /**
102
     * Loads the data for all languages.
@@ 106-115 (lines=10) @@
103
     *
104
     * @return string[][]
105
     */
106
    public function loadAllLanguagesData()
107
    {
108
        try {
109
            return $this->innerGateway->loadAllLanguagesData();
110
        } catch (DBALException $e) {
111
            throw new RuntimeException('Database error', 0, $e);
112
        } catch (PDOException $e) {
113
            throw new RuntimeException('Database error', 0, $e);
114
        }
115
    }
116
117
    /**
118
     * Deletes the language with $id.
@@ 122-131 (lines=10) @@
119
     *
120
     * @param int $id
121
     */
122
    public function deleteLanguage($id)
123
    {
124
        try {
125
            return $this->innerGateway->deleteLanguage($id);
126
        } catch (DBALException $e) {
127
            throw new RuntimeException('Database error', 0, $e);
128
        } catch (PDOException $e) {
129
            throw new RuntimeException('Database error', 0, $e);
130
        }
131
    }
132
133
    /**
134
     * Check whether a language may be deleted.
@@ 140-149 (lines=10) @@
137
     *
138
     * @return bool
139
     */
140
    public function canDeleteLanguage($id)
141
    {
142
        try {
143
            return $this->innerGateway->canDeleteLanguage($id);
144
        } catch (DBALException $e) {
145
            throw new RuntimeException('Database error', 0, $e);
146
        } catch (PDOException $e) {
147
            throw new RuntimeException('Database error', 0, $e);
148
        }
149
    }
150
}
151