Completed
Pull Request — master (#97)
by
unknown
03:44
created

TemporaryLink   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 61
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A setMetadata() 0 7 2
A getMetadata() 0 4 1
A getLink() 0 4 1
1
<?php
2
namespace Kunnu\Dropbox\Models;
3
4
class TemporaryLink extends BaseModel
5
{
6
7
    /**
8
     * The temporary link
9
     *
10
     * @var string
11
     */
12
    protected $link;
13
14
    /**
15
     * File Metadata
16
     *
17
     * @var \Kunnu\Dropbox\Models\FileMetadata
18
     */
19
    protected $metadata;
20
21
22
    /**
23
     * Create a new TemporaryLink instance
24
     *
25
     * @param array $data
26
     */
27 1
    public function __construct(array $data)
28
    {
29 1
        parent::__construct($data);
30 1
        $this->link = $this->getDataProperty('link');
31 1
        $this->setMetadata();
32 1
    }
33
34
    /**
35
     * Set Metadata
36
     */
37 1
    protected function setMetadata()
38
    {
39 1
        $metadata = $this->getDataProperty('metadata');
40 1
        if (is_array($metadata)) {
41 1
            $this->metadata = new FileMetadata($metadata);
42
        }
43 1
    }
44
45
    /**
46
     * The metadata for the file
47
     *
48
     * @return \Kunnu\Dropbox\Models\FileMetadata
49
     */
50 1
    public function getMetadata()
51
    {
52 1
        return $this->metadata;
53
    }
54
55
    /**
56
     * Get the temporary link
57
     *
58
     * @return string
59
     */
60 1
    public function getLink()
61
    {
62 1
        return $this->link;
63
    }
64
}
65