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

PrivateMessageFolderItem   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 51
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getDescription() 0 3 1
A getCategoryCountNew() 0 4 1
A getId() 0 3 1
A getCategoryCount() 0 4 1
A __construct() 0 1 1
A isMain() 0 3 1
A isDropable() 0 3 1
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