ThreemaGateway_Installer_Keystore::destroy()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 5
Ratio 100 %

Importance

Changes 0
Metric Value
dl 5
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
/**
3
 * Adds/Deletes the keystore.
4
 *
5
 * @package ThreemaGateway
6
 * @author rugk
7
 * @copyright Copyright (c) 2015-2016 rugk
8
 * @license MIT
9
 */
10
11
/**
12
 * Methods for creating or deleting the keystore table.
13
 */
14 View Code Duplication
class ThreemaGateway_Installer_Keystore
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
{
16
    /**
17
     * @var string database table name
18
     */
19
    const DB_TABLE = 'xf_threemagw_keystore';
20
21
    /**
22
     * Create a new keystore (table) in the database.
23
     */
24
    public function create()
25
    {
26
        $db = XenForo_Application::get('db');
27
        $db->query('CREATE TABLE `' . self::DB_TABLE . '`
28
            (`threema_id` CHAR(8) NOT NULL PRIMARY KEY,
29
            `public_key` CHAR(64) NOT NULL)
30
            ');
31
    }
32
33
    /**
34
     * Deletes the keystore (table).
35
     */
36
    public function destroy()
37
    {
38
        $db = XenForo_Application::get('db');
39
        $db->query('DROP TABLE `' . self::DB_TABLE . '`');
40
    }
41
}
42