Code Duplication    Length = 7-9 lines in 2 locations

Apps/Model/Api/Comments/CommentPostAdd.php 1 location

@@ 42-50 (lines=9) @@
39
    /**
40
     * Prepare model data - user ip and other data
41
     */
42
    public function before()
43
    {
44
        // set user ip
45
        $this->ip = App::$Request->getClientIp();
46
        // set user object if auth done
47
        if (App::$User->isAuth()) {
48
            $this->_userId = App::$User->identity()->getId();
49
        }
50
    }
51
52
    /**
53
     * Check comment add conditions. On bad conditions will be throw'd exception.

Apps/Model/Api/Comments/CommentAnswerAdd.php 1 location

@@ 36-42 (lines=7) @@
33
        parent::__construct();
34
    }
35
36
    public function before()
37
    {
38
        $this->ip = App::$Request->getClientIp();
39
        if (App::$User->isAuth()) {
40
            $this->_userId = App::$User->identity()->getId();
41
        }
42
    }
43
44
    /**
45
     * Check if comment answer conditions is ok. Will throw exception if not.