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

Test::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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