Completed
Push — 0.0.34 ( 61212b...2e9020 )
by thomas
20:55
created

X509Certificates   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 93
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 60.87%

Importance

Changes 0
Metric Value
dl 0
loc 93
ccs 14
cts 23
cp 0.6087
rs 10
c 0
b 0
f 0
wmc 8
lcom 1
cbo 3

7 Methods

Rating   Name   Duplication   Size   Complexity  
A hasCertificate() 0 4 1
A clearCertificate() 0 4 1
A getCertificate() 0 4 1
A setCertificate() 0 4 1
A getCertificateList() 0 4 1
A addCertificate() 0 4 1
A descriptor() 0 18 2
1
<?php
2
3
namespace BitWasp\Bitcoin\PaymentProtocol\Protobufs;
4
5
use DrSlump\Protobuf\Message;
6
7
class X509Certificates extends Message
8
{
9
10
    /**  @var string[] */
11
    public $certificate = array();
12
13
14
    /** @var \Closure[] */
15
    protected static $__extensions = array();
16
17 2
    public static function descriptor()
18
    {
19 2
        $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'payments.X509Certificates');
20
21
        // REPEATED BYTES certificate = 1
22 2
        $f = new \DrSlump\Protobuf\Field();
23 2
        $f->number = 1;
24 2
        $f->name = 'certificate';
25 2
        $f->type = \DrSlump\Protobuf::TYPE_BYTES;
26 2
        $f->rule = \DrSlump\Protobuf::RULE_REPEATED;
27 2
        $descriptor->addField($f);
28
29 2
        foreach (self::$__extensions as $cb) {
30
            $descriptor->addField($cb(), true);
31
        }
32
33 2
        return $descriptor;
34
    }
35
36
    /**
37
     * Check if <certificate> has a value
38
     *
39
     * @return boolean
40
     */
41
    public function hasCertificate()
42
    {
43
        return $this->_has(1);
44
    }
45
46
    /**
47
     * Clear <certificate> value
48
     *
49
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\X509Certificates
50
     */
51
    public function clearCertificate()
52
    {
53
        return $this->_clear(1);
54
    }
55
56
    /**
57
     * Get <certificate> value
58
     *
59
     * @param int $idx
60
     * @return string
61
     */
62 6
    public function getCertificate($idx = null)
63
    {
64 6
        return $this->_get(1, $idx);
65
    }
66
67
    /**
68
     * Set <certificate> value
69
     *
70
     * @param string $value
71
     * @param int $idx
72
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\X509Certificates
73
     */
74
    public function setCertificate($value, $idx = null)
75
    {
76
        return $this->_set(1, $value, $idx);
77
    }
78
79
    /**
80
     * Get all elements of <certificate>
81
     *
82
     * @return string[]
83
     */
84
    public function getCertificateList()
85
    {
86
        return $this->_get(1);
87
    }
88
89
    /**
90
     * Add a new element to <certificate>
91
     *
92
     * @param string $value
93
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\X509Certificates
94
     */
95 12
    public function addCertificate($value)
96
    {
97 12
        return $this->_add(1, $value);
98
    }
99
}
100