MessageManagerMock   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 2
dl 0
loc 31
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A findBy() 0 10 3
A findByTypes() 0 10 3
A save() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\NotificationBundle\Tests\Entity;
15
16
use Sonata\NotificationBundle\Entity\MessageManager;
17
18
/**
19
 * @author Kevin Nedelec <[email protected]>
20
 */
21
class MessageManagerMock extends MessageManager
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null)
27
    {
28
        $result = [];
29
        while (null !== $limit && $limit > 0) {
30
            $result[$limit] = new Message();
31
            --$limit;
32
        }
33
34
        return $result;
35
    }
36
37
    public function findByTypes(array $types, $state, $batchSize)
38
    {
39
        $result = [];
40
        while (null !== $batchSize && $batchSize > 0) {
41
            $result[$batchSize] = new Message();
42
            --$batchSize;
43
        }
44
45
        return $result;
46
    }
47
48
    public function save($message, $andFlush = true): void
49
    {
50
    }
51
}
52