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

MediaMetadata   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 72
ccs 0
cts 22
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 2
A getLocation() 0 4 1
A getDimensions() 0 4 1
A getTimeTaken() 0 4 1
1
<?php
2
namespace Dropbox\Models;
3
4
use DateTime;
5
6
class MediaMetadata extends BaseModel
7
{
8
9
    /**
10
     * The GPS coordinate of the photo/video.
11
     *
12
     * @var array
13
     */
14
    protected $location = array();
15
16
    /**
17
     * Dimension of the photo/video.
18
     *
19
     * @var array
20
     */
21
    protected $dimensions = array();
22
23
    /**
24
     * The timestamp when the photo/video is taken.
25
     *
26
     * @var DateTime
27
     */
28
    protected $time_taken;
29
30
31
    /**
32
     * Create a new MediaMetadata instance
33
     *
34
     * @param array $data
35
     */
36
    public function __construct(array $data)
37
    {
38
        parent::__construct($data);
39
        $this->location = (array) $this->getDataProperty('location');
40
        $this->dimensions = (array) $this->getDataProperty('dimensions');
41
42
        $time_taken = $this->getDataProperty('time_taken');
43
        if ($time_taken) {
44
            $this->time_taken = new DateTime($time_taken);
45
        }
46
    }
47
48
    /**
49
     * Get the location of the Media
50
     *
51
     * @return array
52
     */
53
    public function getLocation()
54
    {
55
        return $this->location;
56
    }
57
58
    /**
59
     * Get the dimensions of the Media
60
     *
61
     * @return array
62
     */
63
    public function getDimensions()
64
    {
65
        return $this->dimensions;
66
    }
67
68
    /**
69
     * Get the Time the Media was taken on
70
     *
71
     * @return DateTime
72
     */
73
    public function getTimeTaken()
74
    {
75
        return $this->time_taken;
76
    }
77
}
78