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 SerialiserVarDatabase extends AbstractSerialiser implements SerialiserInterface |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @param EntityInterface $entity |
23
|
|
|
* @return string |
24
|
|
|
*/ |
25
|
1 |
|
public function serialise(EntityInterface $entity) |
26
|
|
|
{ |
27
|
1 |
|
$properties = []; |
28
|
1 |
|
$properties[] = $this->stringEscaper->escape($entity->getName()); |
|
|
|
|
29
|
1 |
|
$properties[] = $this->stringEscaper->escape($entity->getDataSource()); |
|
|
|
|
30
|
1 |
|
$properties[] = $this->stringEscaper->escape($entity->getRefFileName()); |
|
|
|
|
31
|
1 |
|
$properties[] = $this->stringEscaper->escape($entity->getTable()); |
|
|
|
|
32
|
1 |
|
$properties[] = $this->stringEscaper->escape($entity->getKeyField()); |
|
|
|
|
33
|
1 |
|
$properties[] = $this->stringEscaper->escape($entity->getDataField()); |
|
|
|
|
34
|
1 |
|
$properties[] = $this->stringEscaper->escape($entity->getPrompt()); |
|
|
|
|
35
|
1 |
|
$properties[] = $entity->getDisplayLength(); |
|
|
|
|
36
|
1 |
|
$properties[] = $entity->getTrimTrailingSpaces(); |
|
|
|
|
37
|
1 |
|
$properties[] = $entity->getPrintAll(); |
|
|
|
|
38
|
1 |
|
$properties[] = $entity->getFixedKey(); |
|
|
|
|
39
|
1 |
|
$properties[] = $entity->getSingleData(); |
|
|
|
|
40
|
1 |
|
$properties[] = $entity->getUsePrompt(); |
|
|
|
|
41
|
1 |
|
$properties[] = $this->stringEscaper->escape($entity->getKeyData()); |
|
|
|
|
42
|
1 |
|
$properties[] = $this->stringEscaper->escape($entity->getFixedKeyData()); |
|
|
|
|
43
|
1 |
|
$properties[] = $this->stringEscaper->escape($entity->getCodePage()); |
|
|
|
|
44
|
1 |
|
$properties[] = $entity->getNumberOfDecimals(); |
|
|
|
|
45
|
1 |
|
$properties[] = $entity->getRunSequence(); |
|
|
|
|
46
|
1 |
|
$properties[] = $entity->getActionWhenDone(); |
|
|
|
|
47
|
1 |
|
$properties[] = $entity->getrawBaseData(); |
|
|
|
|
48
|
1 |
|
$properties[] = $entity->getDatabaseType(); |
|
|
|
|
49
|
1 |
|
$properties[] = $entity->getcPadding(); |
|
|
|
|
50
|
|
|
|
51
|
1 |
|
return implode(',', $properties); |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
|