1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* responsive-images-css |
5
|
|
|
* |
6
|
|
|
* @category Jkphl |
7
|
|
|
* @package Jkphl\Respimgcss |
8
|
|
|
* @subpackage Jkphl\Respimgcss\Application\Model |
9
|
|
|
* @author Joschi Kuphal <[email protected]> / @jkphl |
10
|
|
|
* @copyright Copyright © 2018 Joschi Kuphal <[email protected]> / @jkphl |
11
|
|
|
* @license http://opensource.org/licenses/MIT The MIT License (MIT) |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
/*********************************************************************************** |
15
|
|
|
* The MIT License (MIT) |
16
|
|
|
* |
17
|
|
|
* Copyright © 2018 Joschi Kuphal <[email protected]> / @jkphl |
18
|
|
|
* |
19
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of |
20
|
|
|
* this software and associated documentation files (the "Software"), to deal in |
21
|
|
|
* the Software without restriction, including without limitation the rights to |
22
|
|
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
23
|
|
|
* the Software, and to permit persons to whom the Software is furnished to do so, |
24
|
|
|
* subject to the following conditions: |
25
|
|
|
* |
26
|
|
|
* The above copyright notice and this permission notice shall be included in all |
27
|
|
|
* copies or substantial portions of the Software. |
28
|
|
|
* |
29
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
30
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
31
|
|
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
32
|
|
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
33
|
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
34
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
35
|
|
|
***********************************************************************************/ |
36
|
|
|
|
37
|
|
|
namespace Jkphl\Respimgcss\Domain\Model; |
38
|
|
|
|
39
|
|
|
use Jkphl\Respimgcss\Domain\Contract\ImageCandidateInterface; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Abstract image candidate |
43
|
|
|
* |
44
|
|
|
* @package Jkphl\Respimgcss |
45
|
|
|
* @subpackage Jkphl\Respimgcss\Application |
46
|
|
|
*/ |
47
|
|
|
abstract class AbstractImageCandidate implements ImageCandidateInterface |
48
|
|
|
{ |
49
|
|
|
/** |
50
|
|
|
* Image candidate file |
51
|
|
|
* |
52
|
|
|
* @var string |
53
|
|
|
*/ |
54
|
|
|
protected $file; |
55
|
|
|
/** |
56
|
|
|
* Image candidate value |
57
|
|
|
* |
58
|
|
|
* @var int |
59
|
|
|
*/ |
60
|
|
|
protected $value; |
61
|
|
|
/** |
62
|
|
|
* Image candidate type |
63
|
|
|
* |
64
|
|
|
* @var string |
65
|
|
|
*/ |
66
|
|
|
protected $type; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Image candidate constructor |
70
|
|
|
* |
71
|
|
|
* @param string $file Image candidate file path and name |
72
|
|
|
* @param int $value Image candidate value |
73
|
|
|
*/ |
74
|
37 |
|
public function __construct(string $file, int $value) |
75
|
|
|
{ |
76
|
37 |
|
$this->file = $file; |
77
|
37 |
|
$this->value = $value; |
78
|
37 |
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Return the image candidate file path and name |
82
|
|
|
* |
83
|
|
|
* @return string Image candidate file path and name |
84
|
|
|
*/ |
85
|
11 |
|
public function getFile(): string |
86
|
|
|
{ |
87
|
11 |
|
return $this->file; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Return the image candidate value |
92
|
|
|
* |
93
|
|
|
* @return int Image candidate value |
94
|
|
|
*/ |
95
|
24 |
|
public function getValue(): int |
96
|
|
|
{ |
97
|
24 |
|
return $this->value; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Return the image candidate type |
102
|
|
|
* |
103
|
|
|
* @return string Image candidate type |
104
|
|
|
*/ |
105
|
21 |
|
public function getType(): string |
106
|
|
|
{ |
107
|
21 |
|
return $this->type; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Return the image candidate string |
112
|
|
|
* |
113
|
|
|
* @return string Image candidate string |
114
|
|
|
*/ |
115
|
3 |
|
public function __toString(): string |
116
|
|
|
{ |
117
|
3 |
|
return $this->file.' '.$this->value.$this->type; |
118
|
|
|
} |
119
|
|
|
} |
120
|
|
|
|