ChangePasswordExamplePlugin   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 39
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A Init() 0 4 1
A MainFabrica() 0 14 2
A configMapping() 0 9 1
1
<?php
2
3
class ChangePasswordExamplePlugin extends \RainLoop\Plugins\AbstractPlugin
4
{
5
	public function Init()
6
	{
7
		$this->addHook('main.fabrica', 'MainFabrica');
8
	}
9
10
	/**
11
	 * @param string $sName
12
	 * @param mixed $oProvider
13
	 */
14
	public function MainFabrica($sName, &$oProvider)
15
	{
16
		switch ($sName)
17
		{
18
			case 'change-password':
19
20
				include_once __DIR__.'/ChangePasswordExampleDriver.php';
21
22
				$oProvider = new ChangePasswordExampleDriver();
23
				$oProvider->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', ''))));
24
25
				break;
26
		}
27
	}
28
29
	/**
30
	 * @return array
31
	 */
32
	public function configMapping()
33
	{
34
		return array(
35
			\RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails')
36
				->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT)
37
				->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: [email protected] [email protected] *@domain2.net')
38
				->SetDefaultValue('*')
39
		);
40
	}
41
}