Code Duplication    Length = 8-8 lines in 7 locations

controllers/ContentController.php 1 location

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

controllers/FlowController.php 1 location

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

controllers/ScreenController.php 1 location

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

controllers/TemplateBackgroundController.php 1 location

@@ 100-107 (lines=8) @@
97
     *
98
     * @throws NotFoundHttpException if the model cannot be found
99
     */
100
    protected function findModel($id)
101
    {
102
        if (($model = TemplateBackground::findOne($id)) !== null) {
103
            return $model;
104
        } else {
105
            throw new NotFoundHttpException(Yii::t('app', 'The requested template background does not exist.'));
106
        }
107
    }
108
}
109

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

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/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