blob: b4e80baab117a885bdc54f9ab0567464f3809dc2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<?php
/**
* The StudipLink class abstracts Links so that they can be displayed in a
* uniform manner more easily.
*/
class StudipLink
{
/**
* The title that shall be displayed.
*/
public $title = "";
/**
* The icon for the link.
*/
public $icon = null;
/**
* The link itself.
*/
public $link = "";
/**
* Attributes for the link.
*/
public $attributes = [];
public function __construct(string $link, string $title, Icon $icon)
{
$this->link = $link;
$this->title = $title;
$this->icon = $icon;
}
public function __toString()
{
$template = '<a href="%1$s">%2$s %3$s</a>';
return sprintf($template, $this->link, $this->title, $this->icon);
}
}
|