BuildsController::latestAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 5
ccs 0
cts 4
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Wulkanowy\BitriseRedirector\Controller;
4
5
use Psr\SimpleCache\InvalidArgumentException;
6
use RuntimeException;
7
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
8
use Symfony\Component\HttpFoundation\RedirectResponse;
9
use Wulkanowy\BitriseRedirector\Service\BuildsService;
10
use Wulkanowy\BitriseRedirector\Service\RequestFailedException;
11
12
class BuildsController extends AbstractController
13
{
14
    /**
15
     * @param BuildsService $builds
16
     * @param string        $slug
17
     * @param string        $branch
18
     *
19
     * @throws RuntimeException
20
     * @throws RequestFailedException
21
     * @throws InvalidArgumentException
22
     *
23
     * @return RedirectResponse
24
     */
25
    public function latestAction(BuildsService $builds, string $slug, string $branch): RedirectResponse
26
    {
27
        $lastBuildSlug = $builds->getLastBuildInfoByBranch($branch, $slug)['slug'];
28
29
        return $this->redirect('https://www.bitrise.io/build/'.$lastBuildSlug);
30
    }
31
}
32