Failed Conditions
Pull Request — tos (#941)
by Simon
07:10 queued 03:37
created

PrivacyStatement::main()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 9
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/******************************************************************************
3
 * Wikipedia Account Creation Assistance tool                                 *
4
 * ACC Development Team. Please see team.json for a list of contributors.     *
5
 *                                                                            *
6
 * This is free and unencumbered software released into the public domain.    *
7
 * Please see LICENSE.md for the full licencing statement.                    *
8
 ******************************************************************************/
9
10
namespace Waca\Fragments;
11
12
use Waca\Helpers\MarkdownRenderingHelper;
13
14
trait PrivacyStatement
15
{
16
    protected abstract function assign($name, $value);
17
    protected abstract function templatePath();
18
    protected abstract function setTemplate($name);
19
20
    protected function main()
21
    {
22
        $path = $this->getSiteConfiguration()->getPrivacyStatementPath();
0 ignored issues
show
Bug introduced by
It seems like getSiteConfiguration() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
        $path = $this->/** @scrutinizer ignore-call */ getSiteConfiguration()->getPrivacyStatementPath();
Loading history...
23
        $markdown = file_get_contents($path);
24
25
        $renderer = new MarkdownRenderingHelper();
26
        $this->assign('content', $renderer->doRender($markdown));
27
28
        $this->setTemplate($this->templatePath());
29
    }
30
}