ThreemaGateway_Option_ThreemaGatewayId   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 25
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A verifyOption() 0 13 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