ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
Image.php
Go to the documentation of this file.
1
<?php
2
3
/* Copyright (c) 2016 Timon Amstutz <timon.amstutz@ilub.unibe.ch> Extended GPL, see docs/LICENSE */
4
5
namespace
ILIAS\UI\Implementation\Component\Image
;
6
7
use
ILIAS\UI\Component
as
C
;
8
use
ILIAS\UI\Implementation\Component\ComponentHelper
;
9
14
class
Image
implements
C\Image\Image
15
{
16
use
ComponentHelper
;
17
21
private
$type
;
22
26
private
$src
;
27
31
private
$alt
;
32
36
protected
$url
=
''
;
37
41
private
static
$types
= [
42
self::STANDARD,
43
self::RESPONSIVE
44
];
45
49
public
function
__construct
(
$type
,
$source
,
$alt
)
50
{
51
$this->
checkStringArg
(
"src"
,
$source
);
52
$this->
checkStringArg
(
"alt"
,
$alt
);
53
$this->
checkArgIsElement
(
"type"
,
$type
, self::$types,
"image type"
);
54
55
$this->type =
$type
;
56
$this->src =
$source
;
57
$this->alt =
$alt
;
58
}
59
63
public
function
getType
()
64
{
65
return
$this->type
;
66
}
67
71
public
function
withSource
(
$source
)
72
{
73
$this->
checkStringArg
(
"src"
,
$source
);
74
75
$clone = clone $this;
76
$clone->src =
$source
;
77
return
$clone;
78
}
79
83
public
function
getSource
()
84
{
85
return
$this->src
;
86
}
87
91
public
function
withAlt
(
$alt
)
92
{
93
$this->
checkStringArg
(
"alt"
,
$alt
);
94
95
$clone = clone $this;
96
$clone->alt =
$alt
;
97
return
$clone;
98
}
99
103
public
function
getAlt
()
104
{
105
return
$this->alt
;
106
}
107
111
public
function
withAction
(
$url
)
112
{
113
$this->
checkStringArg
(
"url"
,
$url
);
114
115
$clone = clone $this;
116
$clone->url =
$url
;
117
118
return
$clone;
119
}
120
124
public
function
getAction
()
125
{
126
return
$this->url
;
127
}
128
}
ILIAS\UI\Implementation\Component\checkArgIsElement
checkArgIsElement($which, $value, $array, $name)
Throw an InvalidArgumentException if $value is not an element of array.
Definition:
ComponentHelper.php:132
ILIAS\UI\Implementation\Component\Image\Image\getType
getType()
Definition:
Image.php:63
ILIAS\UI\Implementation\Component\Image\Image\withSource
withSource($source)
Definition:
Image.php:71
ILIAS\UI\Component
ILIAS\UI\Implementation\Component\ComponentHelper
trait ComponentHelper
Provides common functionality for component implementations.
Definition:
ComponentHelper.php:11
ILIAS\UI\Implementation\Component\checkStringArg
checkStringArg($which, $value)
Throw an InvalidArgumentException if $value is no string.
Definition:
ComponentHelper.php:90
ILIAS\UI\Implementation\Component\Image\Image\__construct
__construct($type, $source, $alt)
Definition:
Image.php:49
ILIAS\UI\Implementation\Component\Image\Image\getSource
getSource()
Definition:
Image.php:83
ILIAS\UI\Implementation\Component\Image\Image\$type
$type
Definition:
Image.php:21
ILIAS\UI\Implementation\Component\Image\Image\getAction
getAction()
Definition:
Image.php:124
ILIAS\UI\Implementation\Component\Image\Image
Definition:
Image.php:14
ILIAS\UI\Implementation\Component\Image\Image\$src
$src
Definition:
Image.php:26
ILIAS\UI\Implementation\Component\Image
Definition:
Factory.php:5
ILIAS\UI\Implementation\Component\Image\Image\getAlt
getAlt()
Definition:
Image.php:103
ILIAS\UI\Implementation\Component\Image\Image\$types
static $types
Definition:
Image.php:41
ILIAS\UI\Implementation\Component\Image\Image\$alt
$alt
Definition:
Image.php:31
$source
$source
Definition:
linkback.php:22
ILIAS\UI\Implementation\Component\Image\Image\withAction
withAction($url)
Definition:
Image.php:111
ILIAS\UI\Implementation\Component\Image\Image\withAlt
withAlt($alt)
Definition:
Image.php:91
ILIAS\UI\Implementation\Component\Image\Image\$url
$url
Definition:
Image.php:36
src
UI
Implementation
Component
Image
Image.php
Generated on Sat Jan 18 2025 19:01:02 for ILIAS by
1.8.13 (using
Doxyfile
)