Code Duplication    Length = 13-13 lines in 2 locations

common/models/Widget.php 1 location

@@ 106-118 (lines=13) @@
103
    /**
104
     * @inheritdoc
105
     */
106
    public function beforeSave($insert)
107
    {
108
        if (parent::beforeSave($insert)) {
109
            if ($this->isNewRecord) {
110
                $this->date = new Expression('NOW()');
111
            }
112
            $this->modified = new Expression('NOW()');
113
114
            return true;
115
        }
116
117
        return false;
118
    }
119
}
120

common/models/Module.php 1 location

@@ 201-213 (lines=13) @@
198
    /**
199
     * @inheritdoc
200
     */
201
    public function beforeSave($insert)
202
    {
203
        if (parent::beforeSave($insert)) {
204
            if ($this->isNewRecord) {
205
                $this->date = new Expression('NOW()');
206
            }
207
            $this->modified = new Expression('NOW()');
208
209
            return true;
210
        }
211
212
        return false;
213
    }
214
}
215