Failed Conditions
Push — newinternal-releasecandidate ( 327c61...a30d14 )
by Simon
15:28 queued 05:26
created

JsTemplateConfirmsAction::executeApiAction()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 15
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 15
rs 10
cc 3
nc 3
nop 0
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