DraftNotificationsVariable::getUserGroupOption()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Craft;
4
5
/**
6
 * Draft notifications variable.
7
 */
8
class DraftNotificationsVariable
9
{
10
11
    /**
12
     * @return array
13
     */
14 8
    public function getUserGroupOptions()
15
    {
16 8
        $userGroups = craft()->userGroups->getAllGroups();
17 8
        return array_map(array($this, 'getUserGroupOption'), $userGroups);
18
    }
19
20
    /**
21
     * @param UserGroupModel $group
22
     * @return array
23
     */
24 6
    private function getUserGroupOption(UserGroupModel $group) {
25
        return array(
26 6
            'label' => $group->name,
27 6
            'value' => $group->handle,
28 6
        );
29
    }
30
}