Completed
Pull Request — master (#70)
by
unknown
03:57
created

Image::getDensity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Passbook package.
5
 *
6
 * (c) Eymen Gunay <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Passbook\Pass;
13
14
/**
15
 * Image
16
 *
17
 * Must be one of the following values:
18
 * background - The image displayed as the background of the front of the pass.
19
 * footer - The image displayed on the front of the pass near the barcode.
20
 * icon - The pass’s icon. This is displayed in notifications and in emails that have a pass attached, and on the lock screen.
21
 * logo - The image displayed on the front of the pass in the top left.
22
 * strip - The image displayed behind the primary fields on the front of the pass.
23
 * thumbnail - An additional image displayed on the front of the pass. For example, on a membership card, the thumbnail could be used to a picture of the cardholder.
24
 *
25
 * @author Eymen Gunay <[email protected]>
26
 */
27
class Image extends \SplFileObject implements ImageInterface
28
{
29
    /**
30
     * Image context. Must be one of the following values:
31
     * thumbnail, icon, background, logo, footer, strip
32
     * @var string
33
     */
34
    protected $context;
35
36
    /**
37
     * All of the pass’s images are loaded using standard UIImage image-loading methods.
38
     * This means, for example, the file name of high resolution versions of the image ends with @2x.png/@3x.png.
39
     * @var integer
40
     */
41
    protected $density;
42
43
    public function __construct($filename, $context)
44
    {
45
        // Call parent
46
        parent::__construct($filename);
47
        // Pass image context
48
        $this->setContext($context);
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54
    public function setContext($context)
55
    {
56
        $this->context = $context;
57
58
        return $this;
59
    }
60
61
    /**
62
     * {@inheritdoc}
63
     */
64
    public function getContext()
65
    {
66
        return $this->context;
67
    }
68
69
    /**
70
     * {@inheritdoc}
71
     */
72
    public function setDensity($density)
73
    {
74
        $this->density = $density;
75
76
        return $this;
77
    }
78
79
    /**
80
     * {@inheritdoc}
81
     */
82
    public function getDensity()
83
    {
84
        return $this->density;
85
    }
86
}
87