1 | <?php |
||
20 | class RedmineApiClientMock implements RedmineApiClientInterface |
||
21 | { |
||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $connectedUser = false; |
||
26 | |||
27 | private $usersData = [ |
||
28 | 'test' => [ |
||
29 | 'user' => [ |
||
30 | 'mail' => '[email protected]', |
||
31 | 'login' => 'test', |
||
32 | 'api_key' => 'api-key', |
||
33 | 'password' => 'test', |
||
34 | 'firstname' => 'Te', |
||
35 | 'lastname' => 'St' |
||
36 | ] |
||
37 | ], |
||
38 | 'test-unauthorized' => [ |
||
39 | 'user' => [ |
||
40 | 'mail' => '[email protected]', |
||
41 | 'login' => 'test-unauthorized', |
||
42 | 'api_key' => 'api-key2', |
||
43 | 'password' => 'test', |
||
44 | 'firstname' => 'Te', |
||
45 | 'lastname' => 'St 2' |
||
46 | ] |
||
47 | ] |
||
48 | ]; |
||
49 | |||
50 | /** |
||
51 | * {@inheritdoc} |
||
52 | */ |
||
53 | public function __construct(string $url) |
||
58 | |||
59 | /** |
||
60 | * Set the Redmine client Class |
||
61 | * |
||
62 | * @param string $clientClass |
||
63 | */ |
||
64 | public function setClientClass(string $clientClass) |
||
69 | |||
70 | /** |
||
71 | * {@inheritdoc} |
||
72 | */ |
||
73 | public function connect(string $login, string $password) |
||
81 | |||
82 | /** |
||
83 | * {@inheritdoc} |
||
84 | */ |
||
85 | public function api(string $apiName) |
||
94 | |||
95 | /** |
||
96 | * Retrieve current connected user |
||
97 | * |
||
98 | * @return mixed|null |
||
99 | */ |
||
100 | public function getCurrentUser() |
||
104 | } |
||
105 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: