Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
UseraccountList
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 2
56
0.00% covered (danger)
0.00%
0 / 1
 withoutDublicates
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
12
 withAccessByWorkstation
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
20
1<?php
2
3namespace BO\Zmsentities\Collection;
4
5/**
6 * @extends Base<\BO\Zmsentities\Useraccount>
7 */
8class UseraccountList extends Base
9{
10    public const ENTITY_CLASS = '\BO\Zmsentities\UserAccount';
11
12    public function withoutDublicates()
13    {
14        $collection = new self();
15        foreach ($this as $useraccount) {
16            if (! $collection->hasEntity($useraccount->getId())) {
17                $collection->addEntity($useraccount);
18            }
19        }
20        return $collection;
21    }
22
23    public function withAccessByWorkstation($workstation)
24    {
25        $collection = new self();
26        $departmentList = $workstation->getDepartmentList();
27        foreach ($this as $useraccount) {
28            if ($useraccount->hasPermissions(['department'])) {
29                $accessedList = $departmentList;
30            } else {
31                $accessedList = $departmentList->withAccess($useraccount);
32            }
33
34            if ($accessedList->count()) {
35                $collection->addEntity($useraccount);
36            }
37        }
38        return $collection;
39    }
40}