_getExistingData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * DataWriter for Threema database keystore.
4
 *
5
 * As public keys and Threema IDs are linked together and cannot be changed this
6
 * DataWriter does not use real _getExistingData or _getUpdateCondition.
7
 *
8
 * @package ThreemaGateway
9
 * @author rugk
10
 * @copyright Copyright (c) 2016 rugk
11
 * @license MIT
12
 */
13
14
class ThreemaGateway_DataWriter_Keystore extends XenForo_DataWriter
15
{
16
    /**
17
     * Gets the fields that are defined for the table. See parent for explanation.
18
     *
19
     * @see XenForo_DataWriter::_getFields()
20
     * @return array
21
     */
22
    protected function _getFields()
23
    {
24
        return [
25
            ThreemaGateway_Model_Keystore::DB_TABLE => [
26
                'threema_id' => [
27
                    'type' => self::TYPE_STRING,
28
                    'required'  => true,
29
                    'maxLength' => 8
30
                ],
31
                'public_key'    => [
32
                    'type' => self::TYPE_STRING,
33
                    'required'  => true,
34
                    'maxLength' => 64
35
                ],
36
            ]
37
        ];
38
    }
39
40
    /**
41
     * Gets the actual existing data out of data that was passed in. See parent for explanation.
42
     *
43
     * As an update cannot happen in the keystore anyway, this function is not
44
     * implemented in any way.
45
     *
46
     * @param mixed $data
47
     * @see XenForo_DataWriter::_getExistingData()
48
     * @return array
49
     */
50
    protected function _getExistingData($data)
51
    {
52
        return [];
53
    }
54
55
    /**
56
     * Gets SQL condition to update the existing record.
57
     *
58
     * As an update cannot happen in the keystore anyway, this function is not
59
     * implemented in any way.
60
     *
61
     * @param string $tableName
62
     * @see XenForo_DataWriter::_getUpdateCondition()
63
     * @return string
64
     */
65
    protected function _getUpdateCondition($tableName)
66
    {
67
        return '';
68
    }
69
}
70