Completed
Push — master ( 008aa0...00b67b )
by Christopher
13:47 queued 06:29
created

JobController::getDaily()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 19
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 12
c 1
b 0
f 0
nc 2
nop 3
dl 0
loc 19
rs 9.4285
1
<?php
2
3
namespace TechWilk\Rota\Controller;
4
5
use GuzzleHttp\Client;
6
use Psr\Http\Message\ResponseInterface;
7
use Psr\Http\Message\ServerRequestInterface;
8
use TechWilk\Rota\Site;
9
10
class JobController extends BaseController
11
{
12
    public function getDaily(ServerRequestInterface $request, ResponseInterface $response, $args)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
13
    {
14
        $this->logger->info("Fetch event GET '/jobs/daily'");
15
        $site = new Site();
16
        $actualToken = $site->getSettings()->getToken();
17
        if ($args['token'] !== $actualToken) {
18
            return $response;
19
        }
20
21
        $client = new Client();
22
        $url = $site->getUrl()['base'].$this->router->pathFor('home').'old/cr_daily.php';
23
        $response = $client->get($url, [
24
            'query' => [
25
                'token' => $args['token'],
26
            ],
27
        ]);
28
29
        return $response;
30
    }
31
}
32