Completed
Push — master ( b34763...3537a1 )
by thomas
71:35
created

PaymentHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace BitWasp\Bitcoin\PaymentProtocol;
4
5
use BitWasp\Bitcoin\PaymentProtocol\Protobufs\Payment;
6
use BitWasp\Bitcoin\PaymentProtocol\Protobufs\PaymentACK;
7
8
class PaymentHandler
9
{
10
    /**
11
     * @param Payment $payment
12
     * @param string $memo
13
     * @return PaymentACK
14
     */
15
    public function getPaymentAck(Payment $payment, $memo = null)
16
    {
17
        $ack = new PaymentACK();
18
        $ack->setPayment($payment);
19
20
        if (is_string($memo)) {
21
            $ack->setMemo($memo);
22 24
        }
23
24 24
        return $ack;
25 24
    }
26
}
27