1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of graze/unicontroller-client. |
4
|
|
|
* |
5
|
|
|
* Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com> |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
* |
10
|
|
|
* @license https://github.com/graze/unicontroller-client/blob/master/LICENSE.md |
11
|
|
|
* @link https://github.com/graze/unicontroller-client |
12
|
|
|
*/ |
13
|
|
|
namespace Graze\UnicontrollerClient\Serialiser\Serialiser; |
14
|
|
|
|
15
|
|
|
use Graze\UnicontrollerClient\Serialiser\Serialiser\AbstractSerialiser; |
16
|
|
|
use Graze\UnicontrollerClient\Serialiser\Serialiser\SerialiserInterface; |
17
|
|
|
use Graze\UnicontrollerClient\Entity\Entity\EntityInterface; |
18
|
|
|
|
19
|
|
|
class SerialiserTtfItem extends AbstractSerialiser implements SerialiserInterface |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @param EntityInterface $entity |
23
|
|
|
* @return string |
24
|
|
|
*/ |
25
|
2 |
|
public function serialise(EntityInterface $entity) |
26
|
|
|
{ |
27
|
2 |
|
$properties = []; |
28
|
2 |
|
$properties[] = $entity->getAnchorPoint(); |
|
|
|
|
29
|
2 |
|
$properties[] = $entity->getXPos(); |
|
|
|
|
30
|
2 |
|
$properties[] = $entity->getYPos(); |
|
|
|
|
31
|
2 |
|
$properties[] = $entity->getWidth(); |
|
|
|
|
32
|
2 |
|
$properties[] = $entity->getHeight(); |
|
|
|
|
33
|
2 |
|
$properties[] = $entity->getOrion(); |
|
|
|
|
34
|
2 |
|
$properties[] = $this->stringEscaper->escape($entity->getDescription()); |
|
|
|
|
35
|
2 |
|
$properties[] = $this->stringEscaper->escape($entity->getFontName()); |
|
|
|
|
36
|
2 |
|
$properties[] = $entity->getFontSize(); |
|
|
|
|
37
|
2 |
|
$properties[] = $entity->getFontBold(); |
|
|
|
|
38
|
2 |
|
$properties[] = $entity->getFontItalic(); |
|
|
|
|
39
|
2 |
|
$properties[] = $entity->getFontUnderline(); |
|
|
|
|
40
|
2 |
|
$properties[] = $entity->getInverted(); |
|
|
|
|
41
|
2 |
|
$properties[] = $entity->getAlignment(); |
|
|
|
|
42
|
2 |
|
$properties[] = $this->stringEscaper->escape($entity->getData()); |
|
|
|
|
43
|
2 |
|
$properties[] = $entity->getFtbMode(); |
|
|
|
|
44
|
2 |
|
$properties[] = $entity->getLineSpacing(); |
|
|
|
|
45
|
2 |
|
$properties[] = $entity->getRemoveBlank(); |
|
|
|
|
46
|
2 |
|
$properties[] = $entity->getFontWidth(); |
|
|
|
|
47
|
2 |
|
$properties[] = $entity->getCharSpacing(); |
|
|
|
|
48
|
2 |
|
$properties[] = $entity->getPhantomField(); |
|
|
|
|
49
|
|
|
|
50
|
2 |
|
return implode(',', $properties); |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|