Code Duplication    Length = 7-9 lines in 2 locations

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

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

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

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