Completed
Push — master ( 721fe7...749edd )
by Park Jong-Hun
11:15 queued 08:43
created

Test::echoTest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
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
use Doctrine\ORM\EntityManagerInterface;
11
12
class Test
13
{
14
    public function echoTest()
15
    {
16
        echo 'Hello Test!';
17
    }
18
19
    public function paramTest($name)
20
    {
21
        echo 'Hello ' . $name . '!';
22
    }
23
24
    public function dbTest(EntityManagerInterface $entityManager)
25
    {
26
        $posts = $entityManager->getRepository(Post::class)->findAll();
27
        return $posts;
28
    }
29
30
    public function goMain()
31
    {
32
        return 'redirect: ' . Application::getUrl();
33
    }
34
35
    public function event()
36
    {
37
        echo 'Event!';
38
    }
39
40
    public function admin()
41
    {
42
        echo 'Admin page';
43
    }
44
45
    public function jsonTest()
46
    {
47
        return [
48
            [
49
                'title' => 'title 1',
50
                'content' => 'content 1'
51
            ],
52
            [
53
                'title' => 'title 2',
54
                'content' => 'content 2'
55
            ],
56
            [
57
                'title' => 'title 3',
58
                'content' => 'content 3'
59
            ]
60
        ];
61
    }
62
}
63