Completed
Pull Request — 2.0 (#18)
by David
02:15
created

ZohoUserService   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 28
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getUsers() 0 9 2
1
<?php
2
3
4
namespace Wabel\Zoho\CRM\Copy;
5
6
use Wabel\Zoho\CRM\Request\Response;
7
use Wabel\Zoho\CRM\ZohoClient;
8
9
/**
10
 * This class acts as a cache for fetching users from Zoho.
11
 */
12
class ZohoUserService
13
{
14
15
    /**
16
     * @var ZohoClient
17
     */
18
    private $zohoClient;
19
20
    /**
21
     * @var Response
22
     */
23
    private $usersResponse;
24
25
    public function __construct(ZohoClient $zohoClient)
26
    {
27
        $this->zohoClient = $zohoClient;
28
    }
29
30
    public function getUsers() : Response
31
    {
32
        if ($this->usersResponse !== null) {
33
            return $this->usersResponse();
0 ignored issues
show
Bug introduced by
The method usersResponse() does not seem to exist on object<Wabel\Zoho\CRM\Copy\ZohoUserService>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
34
        }
35
36
        $this->usersResponse = $this->zohoClient->getUsers();
37
        return $this->usersResponse;
38
    }
39
}
40