-
Notifications
You must be signed in to change notification settings - Fork 6
/
StringContent.php
52 lines (46 loc) · 1.11 KB
/
StringContent.php
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
48
49
50
51
52
<?php
namespace Rokka\Client\LocalImage;
/**
* Creates a LocalImage object with the content of an image as input.
*
* For images on a accessible file system, better use \Rokka\Client\LocalImage\FileInfo
*
* Example:
*
* ```language-php
* $image = new StringContent($content, $identifier, $context);
* ```
*
* @see \Rokka\Client\LocalImage\FileInfo
* @since 1.3.0
*/
class StringContent extends AbstractLocalImage
{
/**
* @var string|null
*/
private $content = null;
/**
* @param string|null $image
* @param string|null $identifier
* @param mixed|null $context
*/
public function __construct($image, $identifier = null, $context = null)
{
parent::__construct($identifier);
$this->content = $image;
$this->context = $context;
}
public function getIdentifier()
{
if (null !== $this->identifier) {
return $this->identifier;
}
$this->identifier = md5((string) $this->getContent());
return $this->identifier;
}
public function getContent()
{
return $this->content;
}
}