Code Duplication    Length = 26-26 lines in 4 locations

Apps/Controller/Admin/Profile.php 1 location

@@ 29-54 (lines=26) @@
26
     * @return string
27
     * @throws \Ffcms\Core\Exception\SyntaxException
28
     */
29
    public function actionIndex()
30
    {
31
        // init Active Record
32
        $query = new ProfileRecords();
33
34
        // set current page and offset
35
        $page = (int)App::$Request->query->get('page');
36
        $offset = $page * self::ITEM_PER_PAGE;
37
38
        // build pagination
39
        $pagination = new SimplePagination([
40
            'url' => ['profile/index'],
41
            'page' => $page,
42
            'step' => self::ITEM_PER_PAGE,
43
            'total' => $query->count()
44
        ]);
45
46
        // build listing objects
47
        $records = $query->orderBy('id', 'desc')->skip($offset)->take(self::ITEM_PER_PAGE)->get();
48
49
        // display viewer
50
        return App::$View->render('index', [
51
            'records' => $records,
52
            'pagination' => $pagination
53
        ]);
54
    }
55
56
    /**
57
     * Redirect to user controller

Apps/Controller/Admin/User.php 1 location

@@ 30-55 (lines=26) @@
27
     * @return string
28
     * @throws \Ffcms\Core\Exception\SyntaxException
29
     */
30
    public function actionIndex()
31
    {
32
        // init Active Record
33
        $query = new UserRecords();
34
35
        // set current page and offset
36
        $page = (int)App::$Request->query->get('page');
37
        $offset = $page * self::ITEM_PER_PAGE;
38
39
        // build pagination
40
        $pagination = new SimplePagination([
41
            'url' => ['user/index'],
42
            'page' => $page,
43
            'step' => self::ITEM_PER_PAGE,
44
            'total' => $query->count()
45
        ]);
46
47
        // build listing objects
48
        $records = $query->orderBy('id', 'desc')->skip($offset)->take(self::ITEM_PER_PAGE)->get();
49
50
        // display viewer
51
        return App::$View->render('index', [
52
            'records' => $records,
53
            'pagination' => $pagination
54
        ]);
55
    }
56
57
    /**
58
     * Edit user profile by id

Apps/Controller/Admin/Comments.php 1 location

@@ 29-54 (lines=26) @@
26
     * @return string
27
     * @throws \Ffcms\Core\Exception\SyntaxException
28
     */
29
    public function actionIndex()
30
    {
31
        // set current page and offset
32
        $page = (int)App::$Request->query->get('page');
33
        $offset = $page * self::ITEM_PER_PAGE;
34
35
        // initialize active record model
36
        $query = new CommentPost();
37
38
        // make pagination
39
        $pagination = new SimplePagination([
40
            'url' => ['comments/index'],
41
            'page' => $page,
42
            'step' => self::ITEM_PER_PAGE,
43
            'total' => $query->count()
44
        ]);
45
46
        // get result as active records object with offset
47
        $records = $query->orderBy('id', 'desc')->skip($offset)->take(self::ITEM_PER_PAGE)->get();
48
49
        // render output view
50
        return App::$View->render('index', [
51
            'records' => $records,
52
            'pagination' => $pagination
53
        ]);
54
    }
55
56
    public function actionAnswerlist()
57
    {

Apps/Controller/Admin/Feedback.php 1 location

@@ 32-57 (lines=26) @@
29
     * @return string
30
     * @throws \Ffcms\Core\Exception\SyntaxException
31
     */
32
    public function actionIndex()
33
    {
34
        // set current page and offset
35
        $page = (int)App::$Request->query->get('page');
36
        $offset = $page * self::ITEM_PER_PAGE;
37
38
        // get feedback posts AR table
39
        $query = new FeedbackPost();
40
41
        // build pagination
42
        $pagination = new SimplePagination([
43
            'url' => ['feedback/index'],
44
            'page' => $page,
45
            'step' => self::ITEM_PER_PAGE,
46
            'total' => $query->count()
47
        ]);
48
49
        // build listing objects
50
        $records = $query->orderBy('id', 'desc')->skip($offset)->take(self::ITEM_PER_PAGE)->get();
51
52
        // render output
53
        return App::$View->render('index', [
54
            'records' => $records,
55
            'pagination' => $pagination
56
        ]);
57
    }
58
59
    /**
60
     * Read feedback post and answer and add answer to thread post