verifyOption()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 6
nc 2
nop 3
1
<?php
2
/**
3
 * Threema Gateway ID option.
4
 *
5
 * @package ThreemaGateway
6
 * @author rugk
7
 * @copyright Copyright (c) 2016 rugk
8
 * @license MIT
9
 */
10
11
class ThreemaGateway_Option_ThreemaGatewayId
12
{
13
    /**
14
     * Verifies the Threema ID format.
15
     *
16
     * @param string             $threemaid  Input threema ID
17
     * @param XenForo_DataWriter $dataWriter
18
     * @param string             $fieldName  Name of field/option
19
     *
20
     * @return bool
21
     */
22
    public static function verifyOption(&$threemaid, XenForo_DataWriter $dataWriter, $fieldName)
23
    {
24
        /** @var mixed $error useless error var */
25
        $error = '';
26
27
        //check for formal errors
28
        if ($threemaid != '' && !ThreemaGateway_Handler_Validation::checkThreemaId($threemaid, 'gateway', $error, false)) {
29
            $dataWriter->error(new XenForo_Phrase('threemagw_invalid_threema_id'), $fieldName);
30
            return false;
31
        }
32
33
        return true;
34
    }
35
}
36