Completed
Push — master ( 588b6d...1f8c3f )
by Park Jong-Hun
03:16
created

Test   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 8
Bugs 0 Features 1
Metric Value
wmc 7
c 8
b 0
f 1
lcom 0
cbo 4
dl 0
loc 51
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A echoTest() 0 4 1
A paramTest() 0 4 1
A dbTest() 0 5 1
A goMain() 0 4 1
A event() 0 4 1
A admin() 0 4 1
A jsonTest() 0 17 1
1
<?php
2
3
namespace App\Controller;
4
5
use App\Entity\Post;
6
7
use Core\Application;
8
use Core\DatabaseManager;
9
use Doctrine\ORM\EntityManager;
10
11
class Test
12
{
13
    public function echoTest()
14
    {
15
        echo 'Hello Test!';
16
    }
17
18
    public function paramTest($name)
19
    {
20
        echo 'Hello ' . $name . '!';
21
    }
22
23
    public function dbTest()
24
    {
25
        $posts = DatabaseManager::getDefaultEntityManager()->getRepository(Post::class)->findAll();
26
        return $posts;
27
    }
28
29
    public function goMain()
30
    {
31
        return 'redirect: ' . Application::getInstance()->url();
32
    }
33
34
    public function event()
35
    {
36
        echo 'Event!';
37
    }
38
39
    public function admin()
40
    {
41
        echo 'Admin page';
42
    }
43
44
    public function jsonTest()
45
    {
46
        return [
47
            [
48
                'title' => 'title 1',
49
                'content' => 'content 1'
50
            ],
51
            [
52
                'title' => 'title 2',
53
                'content' => 'content 2'
54
            ],
55
            [
56
                'title' => 'title 3',
57
                'content' => 'content 3'
58
            ]
59
        ];
60
    }
61
}
62