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

@@ 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.