PurchaseReceipt::__toString()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace DansMaCulotte\Monetico\Receipts;
4
5
class PurchaseReceipt
6
{
7
    /** @var string */
8
    const OUTPUT_FORMAT = "version=2\ncdr=%s\n";
9
10
    /** @var bool */
11
    public $status;
12
13
    /**
14
     * PaymentReceipt constructor.
15
     * @param bool $status
16
     */
17
    public function __construct(bool $status)
18
    {
19
        $this->status = $status;
20
    }
21
22
    /**
23
     * @return string
24
     */
25
    public function __toString(): string
26
    {
27
        return sprintf(self::OUTPUT_FORMAT, $this->status ? 0 : 1);
28
    }
29
}
30