BtcFormat   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 1
dl 0
loc 29
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getText() 0 6 1
1
<?php
2
3
/*
4
 * This file is part of the 2amigos/qrcode-library project.
5
 *
6
 * (c) 2amigOS! <http://2amigos.us/>
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE file that was distributed with this source code.
10
 */
11
12
namespace Da\QrCode\Format;
13
14
/**
15
 * Class Bitcoin formats a string to properly create a Bitcoin URI
16
 *
17
 * @package Da\QrCode\Format
18
 */
19
class BtcFormat extends AbstractFormat
20
{
21
    /**
22
     * @var string the name of the receiver.
23
     */
24
    public $name;
25
    /**
26
     * @var string the message that describes the transaction.
27
     */
28
    public $message;
29
    /**
30
     * @var string the Bitcoin address
31
     */
32
    public $address;
33
    /**
34
     * @var string the payable amount
35
     */
36
    public $amount;
37
38
    /**
39
     * @inheritdoc
40
     */
41
    public function getText(): string
42
    {
43
        $query = http_build_query(['amount' => $this->amount, 'label' => $this->name, 'message' => $this->message]);
44
45
        return "bitcoin:{$this->address}?{$query}";
46
    }
47
}
48