Passed
Push — master ( 13f577...04b25a )
by Filippo
03:34
created

System::match()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @file System.php
5
 * @brief This file contains the System class.
6
 * @details
7
 * @author Filippo F. Fadda
8
 */
9
10
11
namespace Daikengo\User;
12
13
14
use Daikengo\Permission\IPermission;
15
use Daikengo\Collection\RoleCollection;
16
17
18
/**
19
 * @brief A special user used to perform special tasks, for example when you need to run a program from the command line.
20
 * @nosubgrouping
21
 */
22
final class System implements IUser {
23
24
25
  /**
26
   * @brief This implementation returns always `null`.
27
   * @return null
28
   */
29
  public function getId() {
30
    return NULL;
31
  }
32
33
34
  /**
35
   * @brief This implementation returns always `false`.
36
   * @param[in] string $id The id to match.
37
   * @return bool
38
   */
39
  public function match($id) {
40
    return FALSE;
41
  }
42
43
44
  /**
45
   * @brief This implementation returns always `true`.
46
   * @return bool
47
   */
48
  public function has(IPermission $permission) {
49
    return TRUE;
50
  }
51
52
53
  /**
54
   * @brief This implementation returns always `false`.
55
   * @return bool
56
   */
57
  public function isGuest() {
58
    return FALSE;
59
  }
60
61
62
  /**
63
   * @brief This implementation returns always `false`.
64
   * @return bool
65
   */
66
  public function isMember() {
67
    return FALSE;
68
  }
69
70
71
  /**
72
   * @brief This method is never called for this class, but in case it will return an empty collection.
73
   * @return RoleCollection
74
   */
75
  public function getRoles() {
76
    $roles = [];
77
    return new RoleCollection('roles', $roles);
78
  }
79
80
}