BaseMongoMessageModel   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 3
c 3
b 0
f 0
lcom 1
cbo 2
dl 0
loc 19
ccs 9
cts 9
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 11 3
1
<?php
2
3
/**
4
 *  _   __ __ _____ _____ ___  ____  _____
5
 * | | / // // ___//_  _//   ||  __||_   _|
6
 * | |/ // /(__  )  / / / /| || |     | |
7
 * |___//_//____/  /_/ /_/ |_||_|     |_|
8
 * @link https://vistart.name/
9
 * @copyright Copyright (c) 2016 vistart
10
 * @license https://vistart.name/license/
11
 */
12
13
namespace vistart\Models\models;
14
15
use vistart\Models\queries\BaseMongoMessageQuery;
16
use vistart\Models\traits\MessageTrait;
17
18
/**
19
 * This model helps build message model stored in mongodb.
20
 * This model enables the following fields:
21
 * 
22
 * - idAttribute: _id
23
 * - createdAtAttribute: createdAt
24
 * - updatedAtAttribute: updatedAt
25
 * - ipTypeAttribute: ip_type
26
 * - ipAttribute1: ip_1
27
 * - ipAttribute2: ip_2
28
 * - ipAttribute3: ip_3
29
 * - ipAttribute5: ip_4
30
 * 
31
 * - contentAttribute: content
32
 * - createdByAttribute: user_guid
33
 * 
34
 * - otherGuidAttribute: other_guid
35
 * - attachmentAttribute: attachment
36
 * - receivedAtAttribute: received_at
37
 * - readAtAttribute: read_at
38
 * 
39
 * Property:
40
 * - expiredAt: 604800 // 7 days
41
 *
42
 * @version 2.0
43
 * @author vistart <[email protected]>
44
 */
45
abstract class BaseMongoMessageModel extends BaseMongoBlameableModel
46
{
47
    use MessageTrait;
48
49
    public $updatedByAttribute = false;
50
    public $expiredAt = 604800; // 7 days.
51
52 4
    public function init()
53
    {
54 4
        if (!is_string($this->queryClass)) {
55 4
            $this->queryClass = BaseMongoMessageQuery::className();
56 4
        }
57 4
        if ($this->skipInit) {
58 4
            return;
59
        }
60 4
        $this->initMessageEvents();
61 4
        parent::init();
62 4
    }
63
}
64