Completed
Push — master ( 060b04...657701 )
by
unknown
04:35
created

Folder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 31.58%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A jsonSerialize() 0 10 1
A toAPI() 0 6 1
1
<?php
2
/**
3
 * ownCloud - News
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Alessandro Cosentino <[email protected]>
9
 * @author Bernhard Posselt <[email protected]>
10
 * @copyright Alessandro Cosentino 2012
11
 * @copyright Bernhard Posselt 2012, 2014
12
 */
13
14
namespace OCA\News\Db;
15
16
use \OCP\AppFramework\Db\Entity;
17
18
/**
19
 * @method integer getId()
20
 * @method void setId(integer $value)
21
 * @method string getUserId()
22
 * @method void setUserId(string $value)
23
 * @method string getName()
24
 * @method void setName(string $value)
25
 * @method integer getParentId()
26
 * @method void setParentId(integer $value)
27
 * @method boolean getOpened()
28
 * @method void setOpened(boolean $value)
29
 * @method integer getDeletedAt()
30
 * @method void setDeletedAt(integer $value)
31
 * @method integer getLastModified()
32
 * @method void setLastModified(integer $value)
33
34
 */
35
class Folder extends Entity implements IAPI, \JsonSerializable {
36
37
    use EntityJSONSerializer;
38
39
    protected $parentId;
40
    protected $name;
41
    protected $userId;
42
    protected $opened;
43
    protected $deletedAt;
44
    protected $lastModified;
45
46 11
    public function __construct(){
47 11
        $this->addType('parentId', 'integer');
48 11
        $this->addType('opened', 'boolean');
49 11
        $this->addType('deletedAt', 'integer');
50 11
        $this->addType('lastModified', 'integer');
51 11
    }
52
53
    /**
54
     * Turns entitie attributes into an array
55
     */
56
    public function jsonSerialize() {
57
        return $this->serializeFields([
58
            'id',
59
            'parentId',
60
            'name',
61
            'userId',
62
            'opened',
63
            'deletedAt',
64
        ]);
65
    }
66
67
    public function toAPI() {
68
        return $this->serializeFields([
69
            'id',
70
            'name'
71
        ]);
72
    }
73
}