AppRestApi::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 1
1
<?php
2
3
namespace Eole\Sandstone\Tests\Integration\App;
4
5
use Symfony\Component\HttpFoundation\JsonResponse;
6
7
class AppRestApi extends App
8
{
9
    public function __construct(array $values = array())
10
    {
11
        parent::__construct($values);
12
13
        $this->post('api/articles', function () {
14
            $id = 42;
15
            $title = 'Unicorns spotted in Alaska';
16
            $url = 'http://unicorn.com/articles/unicorns-spotted-alaska';
17
18
            $this['dispatcher']->dispatch('article.created', new ArticleCreatedEvent($id, $title, $url));
19
20
            return new JsonResponse($id, 201);
21
        });
22
23
        $this->forwardEventToPushServer('article.created');
24
    }
25
}
26