Data::getUserGroups()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Data for members plugin
5
 *
6
 * PHP Version 5
7
 *
8
 * @category  Plugins
9
 * @package   Members
10
 * @author    Daniel Schalla <[email protected]>
11
 * @copyright 2013 cSphere Team
12
 * @license   http://opensource.org/licenses/bsd-license Simplified BSD License
13
 * @link      http://www.csphere.eu
14
 **/
15
16
namespace csphere\plugins\members\classes;
17
18
/**
19
 * Data for members plugin
20
 *
21
 * @category  Plugins
22
 * @package   Members
23
 * @author    Daniel Schalla <[email protected]>
24
 * @copyright 2013 cSphere Team
25
 * @license   http://opensource.org/licenses/bsd-license Simplified BSD License
26
 * @link      http://www.csphere.eu
27
 **/
28
29
class Data
30
{
31
    /**
32
     * Get all user groups the user is member of.
33
     *
34
     * @param int $userID the ID of a user
35
     *
36
     * @return array an array
37
     */
38
    public static function getUserGroups($userID)
39
    {
40
41
        $table = new \csphere\core\datamapper\Finder("members");
42
43
        $table->where("user_id", "=", $userID);
44
        $table->join("groups", "", "group_id");
45
        return $table->find(0, 0);
46
    }
47
}
48