IsParticipantThreadSpecification   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A isSatisfiedBy() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of the MilioooMessageBundle package.
5
 *
6
 * (c) Michiel boeckaert <[email protected]>
7
 * This source file is subject to the MIT license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace Miliooo\Messaging\Specifications;
12
13
use Miliooo\Messaging\Model\ThreadInterface;
14
use Miliooo\Messaging\User\ParticipantInterface;
15
16
/**
17
 * This checks if the given participant is participant of the given thread.
18
 *
19
 * This can be used when deciding if a participant can see a given thread.
20
 * Since in most cases it does not make sense to not allow a participant to see a thread where he is part of.
21
 *
22
 * @author Michiel Boeckaert <[email protected]>
23
 */
24
class IsParticipantThreadSpecification
25
{
26
    /**
27
     * Checks if the given participant is part of the participants of the thread
28
     *
29
     * @param ParticipantInterface $participant The user that we check for
30
     * @param ThreadInterface      $thread       The thread that we check
31
     *
32
     * @return boolean true if participant can see the thread, false otherwise
33
     */
34
    public function isSatisfiedBy(ParticipantInterface $participant, ThreadInterface $thread)
35
    {
36
        if ($thread->isParticipant($participant)) {
0 ignored issues
show
Unused Code introduced by
This if statement, and the following return statement can be replaced with return $thread->isParticipant($participant);.
Loading history...
37
            return true;
38
        }
39
40
        return false;
41
    }
42
}
43