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

System   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
c 0
b 0
f 0
dl 0
loc 56
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 2 1
A match() 0 2 1
A isMember() 0 2 1
A getRoles() 0 3 1
A isGuest() 0 2 1
A has() 0 2 1
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
}