Failed Conditions
Push — newinternal-releasecandidate ( 327c61...a30d14 )
by Simon
15:28 queued 05:26
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\DataObjects\User;
14
use Waca\Helpers\SearchHelpers\UserSearchHelper;
15
use Waca\Tasks\JsonApiPageBase;
16
use Waca\WebRequest;
17
18
class JsTemplateConfirmsAction extends JsonApiPageBase implements IJsonApiAction
19
{
20
    public function executeApiAction()
21
    {
22
        $this->getDatabase();
23
24
        /** @var EmailTemplate[] $templates */
25
        $templates = EmailTemplate::getAllActiveTemplates(null, $this->getDatabase());
26
27
        $dataset = [];
28
        foreach ($templates as $tpl) {
29
            if($tpl->getJsquestion() != "") {
30
                $dataset[$tpl->getId()] = $tpl->getJsquestion();
31
            }
32
        }
33
34
        return $dataset;
35
    }
36
}
37