Passed
Push — developer ( 6ab04f...7f264c )
by Radosław
31:41 queued 13:45
created

GroupField::operatorOgr()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Group Query Field Class.
4
 *
5
 * @package UIType
6
 *
7
 * @copyright YetiForce S.A.
8
 * @license   YetiForce Public License 5.0 (licenses/LicenseEN.txt or yetiforce.com)
9
 * @author    Adrian Kon <[email protected]>
10
 */
11
12
namespace App\Conditions\QueryFields;
13
14
class GroupField extends BaseField
15
{
16
	/** {@inheritdoc} */
17
	public function getValue()
18
	{
19
		if (\is_array($this->value)) {
20
			return $this->value;
21
		}
22
		return explode('##', $this->value);
23
	}
24
25
	/**
26
	 * Currently logged-in user groups.
27
	 *
28
	 * @return array
29
	 */
30
	public function operatorOgr(): array
31
	{
32
		$groups = \App\Fields\Owner::getInstance($this->getModuleName())->getGroups(false, 'private');
33
		return [$this->getColumnName() => \array_keys($groups)];
34
	}
35
}
36