Completed
Push — master ( fd0858...d5ba90 )
by Andrii
29:08 queued 13:19
created

ReadmeMarkdownController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getTemplate() 0 4 1
A getTwig() 0 4 1
A getReadme() 0 4 1
1
<?php
2
3
/*
4
 * README plugin for HiDev
5
 *
6
 * @link      https://github.com/hiqdev/hidev-readme
7
 * @package   hidev-readme
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2015, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hidev\readme\controllers;
13
14
/**
15
 * Goal for README.md file.
16
 */
17
class ReadmeMarkdownController extends \hidev\controllers\TemplateController
18
{
19
    public function getTemplate()
20
    {
21
        return 'readme-md';
22
    }
23
24
    public function getTwig()
25
    {
26
        return $this->getReadme()->getTwig();
27
    }
28
29
    public function getReadme()
30
    {
31
        return $this->getGoal('readme');
0 ignored issues
show
Documentation Bug introduced by
The method getGoal does not exist on object<hidev\readme\cont...admeMarkdownController>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
32
    }
33
}
34