Completed
Push — master ( 2994aa...19d116 )
by Patrick
08:28
created

FileSharingInfo   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 68
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 68
loc 68
ccs 6
cts 12
cp 0.5
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 7 7 1
A isReadOnly() 4 4 1
A getParentSharedFolderId() 4 4 1
A getModifiedBy() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
namespace Dropbox\Models;
3
4 View Code Duplication
class FileSharingInfo extends BaseModel
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
5
{
6
7
    /**
8
     * True if the file or folder is inside a read-only shared folder.
9
     *
10
     * @var bool
11
     */
12
    protected $read_only;
13
14
    /**
15
     * ID of shared folder that holds this file.
16
     *
17
     * @var string
18
     */
19
    protected $parent_shared_folder_id;
20
21
    /**
22
     * The last user who modified the file.
23
     * This field will be null if the user's account has been deleted.
24
     *
25
     * @var string
26
     */
27
    protected $modified_by;
28
29
    /**
30
     * Create a new File Sharing Info instance
31
     *
32
     * @param array $data
33
     */
34 3
    public function __construct(array $data)
35
    {
36 3
        parent::__construct($data);
37 3
        $this->read_only = $this->getDataProperty('read_only');
38 3
        $this->modified_by = $this->getDataProperty('modified_by');
39 3
        $this->parent_shared_folder_id = $this->getDataProperty('parent_shared_folder_id');
40 3
    }
41
42
    /**
43
     * True if the file or folder is inside a read-only shared folder.
44
     *
45
     * @return bool
46
     */
47
    public function isReadOnly()
48
    {
49
        return $this->read_only;
50
    }
51
52
    /**
53
     * ID of shared folder that holds this file.
54
     *
55
     * @return string
56
     */
57
    public function getParentSharedFolderId()
58
    {
59
        return $this->parent_shared_folder_id;
60
    }
61
62
    /**
63
     * Get the last user who modified the file.
64
     *
65
     * @return string
66
     */
67
    public function getModifiedBy()
68
    {
69
        return $this->modified_by;
70
    }
71
}
72