PurchaseReceipt   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 23
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 3 2
A __construct() 0 3 1
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