Test Failed
Push — newinternal ( 8c4587...b2f220 )
by Michael
15:41 queued 06:17
created

JsTemplateConfirmsAction   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
c 1
b 0
f 0
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A executeApiAction() 0 15 3
1
<?php
2
/******************************************************************************
3
 * Wikipedia Account Creation Assistance tool                                 *
4
 *                                                                            *
5
 * All code in this file is released into the public domain by the ACC        *
6
 * Development Team. Please see team.json for a list of contributors.         *
7
 ******************************************************************************/
8
9
namespace Waca\API\Actions;
10
11
use Waca\API\IJsonApiAction;
12
use Waca\DataObjects\EmailTemplate;
13
use Waca\Tasks\JsonApiPageBase;
14
15
class JsTemplateConfirmsAction extends JsonApiPageBase implements IJsonApiAction
16
{
17
    public function executeApiAction()
18
    {
19
        $this->getDatabase();
20
21
        /** @var EmailTemplate[] $templates */
22
        $templates = EmailTemplate::getAllActiveTemplates(null, $this->getDatabase());
23
24
        $dataset = [];
25
        foreach ($templates as $tpl) {
26
            if ($tpl->getJsquestion() != "") {
27
                $dataset[$tpl->getId()] = $tpl->getJsquestion();
28
            }
29
        }
30
31
        return $dataset;
32
    }
33
}
34