Code

< 40 %
40-60 %
> 60 %
1
<?php
2
3
$plugin_root = __DIR__;
4
if (file_exists("{$plugin_root}/vendor/autoload.php")) {
5
	// check if composer dependencies are distributed with the plugin
6
	require_once "{$plugin_root}/vendor/autoload.php";
7
}
8
9
/**
10
 * Roles service
11
 *
12
 * @staticvar \Elgg\Roles\Api $api
13
 * @return \Elgg\Roles\Api
14
 * @access private
15
 */
16
function roles() {
17 2
	static $api;
18 39
	if (!isset($api)) {
19 38
		$api = new \Elgg\Roles\Api(new \Elgg\Roles\Db());
20 1
	}
21 2
	return $api;
22
}
23