Passed
Push — master ( 8116cf...9d59f1 )
by Adrien
06:29
created

AccountingDocument::getBasePath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Model;
6
7
use Doctrine\ORM\Mapping as ORM;
8
9
/**
10
 * A document attesting an expense claim
11
 *
12
 * @ORM\Entity(repositoryClass="Application\Repository\AccountingDocumentRepository")
13
 */
14
class AccountingDocument extends AbstractFile
15
{
16 2
    protected function getBasePath(): string
17
    {
18 2
        return 'data/accounting/';
19
    }
20
21 1
    protected function getAcceptedMimeTypes(): array
22
    {
23
        return [
24 1
            'image/bmp',
25
            'image/gif',
26
            'image/jpeg',
27
            'image/pjpeg',
28
            'image/png',
29
            'image/webp',
30
            'application/pdf',
31
            'application/x-pdf',
32
        ];
33
    }
34
35
    /**
36
     * @var ExpenseClaim
37
     *
38
     * @ORM\ManyToOne(targetEntity="ExpenseClaim", inversedBy="accountingDocuments")
39
     * @ORM\JoinColumns({
40
     *     @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
41
     * })
42
     */
43
    private $expenseClaim;
44
45
    /**
46
     * @param ExpenseClaim $expenseClaim
47
     */
48 2
    public function setExpenseClaim(ExpenseClaim $expenseClaim): void
49
    {
50 2
        if ($this->expenseClaim && $expenseClaim !== $this->expenseClaim) {
51 1
            $this->expenseClaim->accountingDocumentRemoved($this);
52
        }
53
54 2
        $this->expenseClaim = $expenseClaim;
55 2
        $expenseClaim->accountingDocumentAdded($this);
56 2
    }
57
58
    /**
59
     * @return ExpenseClaim
60
     */
61 1
    public function getExpenseClaim(): ExpenseClaim
62
    {
63 1
        return $this->expenseClaim;
64
    }
65
}
66