Completed
Push — master ( 0417d6...3a7a41 )
by Bob Olde
02:15
created

ApiAuthPlugin   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 4
Bugs 1 Features 2
Metric Value
wmc 6
c 4
b 1
f 2
lcom 0
cbo 0
dl 0
loc 64
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A getVersion() 0 4 1
A getDeveloper() 0 4 1
A getDeveloperUrl() 0 4 1
A registerSiteRoutes() 0 7 1
A init() 0 4 1
1
<?php
2
3
namespace Craft;
4
5
/**
6
 * ApiAuth Plugin.
7
 *
8
 * Authentication plugin for an api
9
 *
10
 * @author    Nerds and company
11
 * @copyright Copyright (c) 2015, Nerds and company
12
 *
13
 * @link      http://www.itmundi.nl
14
 */
15
class ApiAuthPlugin extends BasePlugin
16
{
17
18
    /**
19
     * Return plugin name.
20
     *
21
     * @return string
22
     */
23
    public function getName()
24
    {
25
        return Craft::t('Api Authentication');
26
    }
27
28
    /**
29
     * Return plugin version.
30
     *
31
     * @return string
32
     */
33
    public function getVersion()
34
    {
35
        return '0.2';
36
    }
37
38
    /**
39
     * Return developer name.
40
     *
41
     * @return string
42
     */
43
    public function getDeveloper()
44
    {
45
        return 'Nerds and company';
46
    }
47
48
    /**
49
     * Return developer url.
50
     *
51
     * @return string
52
     */
53
    public function getDeveloperUrl()
54
    {
55
        return 'http://www.nerds.company';
56
    }
57
58
    /**
59
     * Register site routes.
60
     *
61
     * @return array
62
     */
63
    public function registerSiteRoutes()
64
    {
65
        return array(
66
            'api/authenticate' => array('action' => 'apiAuth/authenticate'),
67
            'api/resetPassword' => array('action' => 'apiAuth/resetPassword')
68
        );
69
    }
70
71
    /**
72
     * Load the abstract controller
73
     */
74
    public function init()
75
    {
76
        require_once(__DIR__.'/controllers/AbstractAuthorizedApiController.php');
77
    }
78
}
79