Test Failed
Push — dev ( 6c393a...80c162 )
by Janko
09:39
created

PrivateMessageFolderItem::isMain()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 0
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Module\Message\Lib;
6
7
use Stu\Orm\Entity\PrivateMessageFolderInterface;
8
use Stu\Orm\Repository\PrivateMessageRepositoryInterface;
9
10
class PrivateMessageFolderItem
11
{
12 12
    public function __construct(private PrivateMessageRepositoryInterface $privateMessageRepository, private PrivateMessageFolderInterface $privateMessageFolder) {}
13
14 12
    /**
15
     * Returns the id of the folder
16
     */
17
    public function getId(): int
18
    {
19 7
        return $this->privateMessageFolder->getId();
20
    }
21 7
22
    public function isMain(): bool
23
    {
24
        return $this->privateMessageFolder->getSpecial() === PrivateMessageFolderTypeEnum::SPECIAL_MAIN;
25
    }
26
27 7
    /**
28
     * Returns the name of the folder
29 7
     */
30
    public function getDescription(): string
31
    {
32
        return $this->privateMessageFolder->getDescription();
33
    }
34
35 4
    /**
36
     * Returns the amount if pms
37 4
     */
38 4
    public function getCategoryCount(): int
39 4
    {
40
        return $this->privateMessageRepository->getAmountByFolder(
41
            $this->privateMessageFolder
42
        );
43
    }
44
45 7
    /**
46
     * Returns the amount of new pms
47 7
     */
48 7
    public function getCategoryCountNew(): int
49 7
    {
50
        return $this->privateMessageRepository->getNewAmountByFolder(
51
            $this->privateMessageFolder
52
        );
53
    }
54
55 1
    /**
56
     * Returns `true` if the folder can be moved
57 1
     */
58
    public function isDropable(): bool
59
    {
60
        return $this->privateMessageFolder->isDropable();
61
    }
62
}
63