Completed
Push — develop ( e7f0df...adc625 )
by Marek
02:45
created

UserService::getFollowers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
namespace AppBundle\Service;
3
4
use AppBundle\Entity\Repository\UserRepository;
5
use AppBundle\Entity\User;
6
7
class UserService
8
{
9
    /** @var UserRepository */
10
    private $userRepository;
11
12
    public function __construct(UserRepository $userRepository)
13
    {
14
        $this->userRepository = $userRepository;
15
    }
16
17
    //region Followers and following
18
19
    /**
20
     * Get user's followers
21
     *
22
     * @param int $userId
23
     *
24
     * @return User[]
25
     */
26
    public function getFollowers($userId)
27
    {
28
        //TODO permissions
29
30
        return $this->userRepository->findAllFollowers($userId);
31
    }
32
33
    /**
34
     * Get users followed by user
35
     *
36
     * @param int $userId
37
     *
38
     * @return User[]
39
     */
40
    public function getFollowing($userId)
41
    {
42
        //TODO permissions
43
44
        return $this->userRepository->findAllFollowing($userId);
45
    }
46
47
    /**
48
     * Get active users followed by user
49
     *
50
     * @param int $userId
51
     *
52
     * @return User[]
53
     */
54
    public function getActiveFollowing($userId)
55
    {
56
        //TODO permissions
57
58
        return $this->userRepository->findActiveFollowing($userId);
59
    }
60
61
    //endregion
62
}
63