MDModel   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 5
Bugs 1 Features 0
Metric Value
wmc 3
eloc 10
c 5
b 1
f 0
dl 0
loc 34
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
A getCollection() 0 3 1
A getRandom() 0 3 1
1
<?php
2
3
namespace OfflineAgency\MongoAutoSync\Http\Models;
4
5
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
6
use OfflineAgency\MongoAutoSync\Traits\Helper;
7
use OfflineAgency\MongoAutoSync\Traits\MainMongoTrait;
8
use OfflineAgency\MongoAutoSync\Traits\ModelAdditionalMethod;
9
use OfflineAgency\MongoAutoSync\Traits\PlainMongoTrait;
10
use OfflineAgency\MongoAutoSync\Traits\RelationshipMongoTrait;
11
12
class MDModel extends Eloquent
13
{
14
    use MainMongoTrait, ModelAdditionalMethod, Helper, PlainMongoTrait, RelationshipMongoTrait;
0 ignored issues
show
introduced by
The trait OfflineAgency\MongoAutoS...s\ModelAdditionalMethod requires some properties which are not provided by OfflineAgency\MongoAutoSync\Http\Models\MDModel: $items, $mongoRelation
Loading history...
15
16
    protected $connection = 'mongodb';
17
    protected $dates = [
18
        'deleted_at',
19
        'created_at',
20
        'updated_at',
21
    ];
22
23
    /**
24
     * @return mixed
25
     */
26
    public function getId()
27
    {
28
        return $this->id;
29
    }
30
31
    /**
32
     * @return string
33
     */
34
    public function getCollection()
35
    {
36
        return $this->collection;
37
    }
38
39
    /**
40
     * @param  int  $size
41
     * @return mixed
42
     */
43
    public function getRandom($size = 3)
44
    {
45
        return $this->all()->random($size);
46
    }
47
}
48