Code Duplication    Length = 8-8 lines in 8 locations

controllers/ContentController.php 1 location

@@ 311-318 (lines=8) @@
308
     *
309
     * @throws NotFoundHttpException if the model cannot be found
310
     */
311
    protected function findModel($id)
312
    {
313
        if (($model = Content::findOne($id)) !== null) {
314
            return $model;
315
        } else {
316
            throw new NotFoundHttpException(Yii::t('app', 'The requested content does not exist.'));
317
        }
318
    }
319
}
320

controllers/ContentTypeController.php 1 location

@@ 82-89 (lines=8) @@
79
     *
80
     * @throws NotFoundHttpException if the model cannot be found
81
     */
82
    protected function findModel($id)
83
    {
84
        if (($model = ContentType::findOne($id)) !== null) {
85
            return $model;
86
        } else {
87
            throw new NotFoundHttpException(Yii::t('app', 'The requested content does not exist.'));
88
        }
89
    }
90
}
91

controllers/DeviceController.php 1 location

@@ 190-197 (lines=8) @@
187
     *
188
     * @throws NotFoundHttpException if the model cannot be found
189
     */
190
    protected function findModel($id)
191
    {
192
        if (($model = Device::findOne($id)) !== null) {
193
            return $model;
194
        } else {
195
            throw new NotFoundHttpException(Yii::t('app', 'The requested device does not exist.'));
196
        }
197
    }
198
}
199

controllers/FlowController.php 1 location

@@ 164-171 (lines=8) @@
161
     *
162
     * @throws NotFoundHttpException if the model cannot be found
163
     */
164
    protected function findModel($id)
165
    {
166
        if (($model = Flow::findOne($id)) !== null) {
167
            return $model;
168
        } else {
169
            throw new NotFoundHttpException(Yii::t('app', 'The requested flow does not exist.'));
170
        }
171
    }
172
}
173

controllers/ScreenController.php 1 location

@@ 222-229 (lines=8) @@
219
     *
220
     * @throws NotFoundHttpException if the model cannot be found
221
     */
222
    protected function findModel($id)
223
    {
224
        if (($model = Screen::findOne($id)) !== null) {
225
            return $model;
226
        } else {
227
            throw new NotFoundHttpException(Yii::t('app', 'The requested screen does not exist.'));
228
        }
229
    }
230
}
231

controllers/ScreenTemplateController.php 1 location

@@ 147-154 (lines=8) @@
144
     *
145
     * @throws NotFoundHttpException if the model cannot be found
146
     */
147
    protected function findModel($id)
148
    {
149
        if (($model = ScreenTemplate::findOne($id)) !== null) {
150
            return $model;
151
        } else {
152
            throw new NotFoundHttpException(Yii::t('app', 'The requested template does not exist.'));
153
        }
154
    }
155
156
    /**
157
     * Create a field and save it.

controllers/TemplateBackgroundController.php 1 location

@@ 113-120 (lines=8) @@
110
     *
111
     * @throws NotFoundHttpException if the model cannot be found
112
     */
113
    protected function findModel($id)
114
    {
115
        if (($model = TemplateBackground::findOne($id)) !== null) {
116
            return $model;
117
        } else {
118
            throw new NotFoundHttpException(Yii::t('app', 'The requested template background does not exist.'));
119
        }
120
    }
121
}
122

controllers/UserController.php 1 location

@@ 192-199 (lines=8) @@
189
     *
190
     * @throws NotFoundHttpException if the model cannot be found
191
     */
192
    protected function findModel($id)
193
    {
194
        if (($model = User::findOne($id)) !== null) {
195
            return $model;
196
        } else {
197
            throw new NotFoundHttpException(Yii::t('app', 'The requested user does not exist.'));
198
        }
199
    }
200
}
201