scratch – Blame information for rev 87
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
87 | office | 1 | <?php |
2 | |||
3 | namespace Fusonic\OpenGraph\Elements; |
||
4 | |||
5 | use Fusonic\OpenGraph\Property; |
||
6 | |||
7 | /** |
||
8 | * An Open Graph audio element. |
||
9 | */ |
||
10 | class Audio extends ElementBase |
||
11 | { |
||
12 | /** |
||
13 | * The URL of an audio resource associated with the object. |
||
14 | * |
||
15 | * @var string |
||
16 | */ |
||
17 | public $url; |
||
18 | |||
19 | /** |
||
20 | * An alternate URL to use if an audio resource requires HTTPS. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | public $secureUrl; |
||
25 | |||
26 | /** |
||
27 | * The MIME type of an audio resource associated with the object. |
||
28 | * |
||
29 | * @var type |
||
30 | */ |
||
31 | public $type; |
||
32 | |||
33 | /** |
||
34 | * @param string $url URL to the audio file. |
||
35 | */ |
||
36 | public function __construct($url) |
||
37 | { |
||
38 | parent::__construct(); |
||
39 | |||
40 | $this->url = $url; |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * Gets all properties set on this element. |
||
45 | * |
||
46 | * @return array|Property[] |
||
47 | */ |
||
48 | public function getProperties() |
||
49 | { |
||
50 | $properties = []; |
||
51 | |||
52 | // URL must precede all other properties |
||
53 | if ($this->url !== null) { |
||
54 | $properties[] = new Property(Property::AUDIO_URL, $this->url); |
||
55 | } |
||
56 | |||
57 | if ($this->secureUrl !== null) { |
||
58 | $properties[] = new Property(Property::AUDIO_SECURE_URL, $this->secureUrl); |
||
59 | } |
||
60 | |||
61 | if ($this->type !== null) { |
||
62 | $properties[] = new Property(Property::AUDIO_TYPE, $this->type); |
||
63 | } |
||
64 | |||
65 | return $properties; |
||
66 | } |
||
67 | } |