Passed
Push — bugfix/which-portal ( 090ab7 )
by Tristan
35:14 queued 19:21
created

WhichPortal::isApplicantPortal()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace App\Services;
4
5
use Illuminate\Support\Facades\Route;
6
use Illuminate\Support\Facades\URL;
7
8
class WhichPortal
9
{
10
11 25
    public function isApplicantPortal()
1 ignored issue
show
introduced by
Method \App\Services\WhichPortal::isApplicantPortal() does not have return type hint nor @return annotation for its return value.
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function isApplicantPortal()
Loading history...
12
    {
13 25
        return !$this->isManagerPortal();
14
    }
15
16 30
    public function isManagerPortal()
1 ignored issue
show
introduced by
Method \App\Services\WhichPortal::isManagerPortal() does not have return type hint nor @return annotation for its return value.
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function isManagerPortal()
Loading history...
17
    {
18 30
        $url = URL::current();
19 30
        return $this->urlIsManagerPortal($url);
20
    }
21
22 32
    public function urlIsManagerPortal($url): bool
1 ignored issue
show
introduced by
Method \App\Services\WhichPortal::urlIsManagerPortal() does not have parameter type hint nor @param annotation for its parameter $url.
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function urlIsManagerPortal()
Loading history...
23
    {
24 32
        $baseUrl = config('app.url');
25 32
        $managerPrefix = config('app.manager_prefix');
26 32
        $managerPattern = "#^$baseUrl/(\w+/)?$managerPrefix(/.*)?$#";
27 32
        return preg_match($managerPattern, $url);
0 ignored issues
show
Bug Best Practice introduced by
The expression return preg_match($managerPattern, $url) returns the type integer which is incompatible with the type-hinted return boolean.
Loading history...
28
    }
29
}
30