Code Duplication    Length = 73-73 lines in 2 locations

src/SimpleAcl/Resource/ResourceAggregate.php 1 location

@@ 15-87 (lines=73) @@
12
 *
13
 * @package SimpleAcl\Resource
14
 */
15
class ResourceAggregate extends ObjectAggregate implements ResourceAggregateInterface
16
{
17
  /**
18
   * Add resource.
19
   *
20
   * @param \SimpleAcl\Resource $resource
21
   */
22
  public function addResource(\SimpleAcl\Resource $resource)
23
  {
24
    parent::addObject($resource);
25
  }
26
27
  /**
28
   * Remove all resources.
29
   *
30
   */
31
  public function removeResources()
32
  {
33
    parent::removeObjects();
34
  }
35
36
  /**
37
   * Remove resource by name.
38
   *
39
   * @param Object|string $resourceName
40
   */
41
  public function removeResource($resourceName)
42
  {
43
    parent::removeObject($resourceName);
44
  }
45
46
  /**
47
   * Add resources from array.
48
   *
49
   * @param array $resources
50
   */
51
  public function setResources($resources)
52
  {
53
    parent::setObjects($resources);
54
  }
55
56
  /**
57
   * Return all resources.
58
   *
59
   * @return array|Resource[]
60
   */
61
  public function getResources()
62
  {
63
    return parent::getObjects();
64
  }
65
66
  /**
67
   * Return array of names for registered resources.
68
   *
69
   * @return array
70
   */
71
  public function getResourcesNames(): array
72
  {
73
    return parent::getObjectNames();
74
  }
75
76
  /**
77
   * Return resource by name.
78
   *
79
   * @param Resource|string $resourceName
80
   *
81
   * @return null|Resource
82
   */
83
  public function getResource($resourceName)
84
  {
85
    return parent::getObject($resourceName);
86
  }
87
}
88

src/SimpleAcl/Role/RoleAggregate.php 1 location

@@ 15-87 (lines=73) @@
12
 *
13
 * @package SimpleAcl\Role
14
 */
15
class RoleAggregate extends ObjectAggregate implements RoleAggregateInterface
16
{
17
  /**
18
   * Add role.
19
   *
20
   * @param Role $role
21
   */
22
  public function addRole(Role $role)
23
  {
24
    parent::addObject($role);
25
  }
26
27
  /**
28
   * Remove all roles.
29
   */
30
  public function removeRoles()
31
  {
32
    parent::removeObjects();
33
  }
34
35
  /**
36
   * Remove role by name.
37
   *
38
   * @param Object|string $roleName
39
   */
40
  public function removeRole($roleName)
41
  {
42
    parent::removeObject($roleName);
43
  }
44
45
  /**
46
   * Add roles from array.
47
   *
48
   * @param array $roles
49
   */
50
  public function setRoles($roles)
51
  {
52
    parent::setObjects($roles);
53
  }
54
55
  /**
56
   * Return all roles.
57
   *
58
   * @return array()|Role[]
59
   */
60
  public function getRoles()
61
  {
62
    return parent::getObjects();
63
  }
64
65
  /**
66
   * Return array of names for registered roles.
67
   *
68
   * @return array
69
   */
70
  public function getRolesNames(): array
71
  {
72
    return parent::getObjectNames();
73
  }
74
75
  /**
76
   * Return role by name.
77
   *
78
   * @param Role|string $roleName
79
   *
80
   * @return null|Role
81
   */
82
  public function getRole($roleName)
83
  {
84
    return parent::getObject($roleName);
85
  }
86
}
87