UrlTrait::relationSearchUrl()   A
last analyzed

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
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Yaro\Jarboe\Table\CrudTraits;
4
5
trait UrlTrait
6
{
7 1
    public function editUrl($id)
8
    {
9 1
        return sprintf('%s%s%s', $this->baseUrl(), self::BASE_URL_DELIMITER, $id);
0 ignored issues
show
Bug introduced by
The constant Yaro\Jarboe\Table\CrudTr...ait::BASE_URL_DELIMITER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
10
    }
11
12 1
    public function createUrl()
13
    {
14 1
        return sprintf('%s%screate', $this->baseUrl(), self::BASE_URL_DELIMITER);
0 ignored issues
show
Bug introduced by
The constant Yaro\Jarboe\Table\CrudTr...ait::BASE_URL_DELIMITER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
15
    }
16
17 1
    public function deleteUrl($id)
18
    {
19 1
        return sprintf('%s%s%s/delete', $this->baseUrl(), self::BASE_URL_DELIMITER, $id);
0 ignored issues
show
Bug introduced by
The constant Yaro\Jarboe\Table\CrudTr...ait::BASE_URL_DELIMITER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
20
    }
21
22 1
    public function restoreUrl($id)
23
    {
24 1
        return sprintf('%s%s%s/restore', $this->baseUrl(), self::BASE_URL_DELIMITER, $id);
0 ignored issues
show
Bug introduced by
The constant Yaro\Jarboe\Table\CrudTr...ait::BASE_URL_DELIMITER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
25
    }
26
27 1
    public function forceDeleteUrl($id)
28
    {
29 1
        return sprintf('%s%s%s/force-delete', $this->baseUrl(), self::BASE_URL_DELIMITER, $id);
0 ignored issues
show
Bug introduced by
The constant Yaro\Jarboe\Table\CrudTr...ait::BASE_URL_DELIMITER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
30
    }
31
32 3
    public function toolbarUrl($identifier)
33
    {
34 3
        return sprintf('%s%stoolbar/%s', $this->baseUrl(), self::BASE_URL_DELIMITER, $identifier);
0 ignored issues
show
Bug introduced by
The constant Yaro\Jarboe\Table\CrudTr...ait::BASE_URL_DELIMITER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
35
    }
36
37 5
    public function listUrl()
38
    {
39 5
        return $this->baseUrl();
40
    }
41
42 1
    public function perPageUrl($perPage)
43
    {
44 1
        return sprintf('%s%sper-page/%s', $this->baseUrl(), self::BASE_URL_DELIMITER, $perPage);
0 ignored issues
show
Bug introduced by
The constant Yaro\Jarboe\Table\CrudTr...ait::BASE_URL_DELIMITER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
45
    }
46
47 1
    public function searchUrl()
48
    {
49 1
        return sprintf('%s%ssearch', $this->baseUrl(), self::BASE_URL_DELIMITER);
0 ignored issues
show
Bug introduced by
The constant Yaro\Jarboe\Table\CrudTr...ait::BASE_URL_DELIMITER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
50
    }
51
52 1
    public function relationSearchUrl()
53
    {
54 1
        return sprintf('%s%ssearch/relation', $this->baseUrl(), self::BASE_URL_DELIMITER);
0 ignored issues
show
Bug introduced by
The constant Yaro\Jarboe\Table\CrudTr...ait::BASE_URL_DELIMITER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
55
    }
56
57 58
    public function inlineUrl()
58
    {
59 58
        return sprintf('%s%sinline', $this->baseUrl(), self::BASE_URL_DELIMITER);
0 ignored issues
show
Bug introduced by
The constant Yaro\Jarboe\Table\CrudTr...ait::BASE_URL_DELIMITER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
60
    }
61
62 1
    public function orderUrl($column, $direction)
63
    {
64 1
        return sprintf('%s%sorder/%s/%s', $this->baseUrl(), self::BASE_URL_DELIMITER, $column, $direction);
0 ignored issues
show
Bug introduced by
The constant Yaro\Jarboe\Table\CrudTr...ait::BASE_URL_DELIMITER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
65
    }
66
67 1
    public function reorderUrl()
68
    {
69 1
        return sprintf('%s%sreorder/switch', $this->baseUrl(), self::BASE_URL_DELIMITER);
0 ignored issues
show
Bug introduced by
The constant Yaro\Jarboe\Table\CrudTr...ait::BASE_URL_DELIMITER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
70
    }
71
72 1
    public function reorderMoveItemUrl($id)
73
    {
74 1
        return sprintf('%s%sreorder/move/%s', $this->baseUrl(), self::BASE_URL_DELIMITER, $id);
0 ignored issues
show
Bug introduced by
The constant Yaro\Jarboe\Table\CrudTr...ait::BASE_URL_DELIMITER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
75
    }
76
77
    public function renderRepeaterItemUrl($fieldName)
78
    {
79
        return sprintf('%s%srender-repeater-item/%s', $this->baseUrl(), self::BASE_URL_DELIMITER, $fieldName);
0 ignored issues
show
Bug introduced by
The constant Yaro\Jarboe\Table\CrudTr...ait::BASE_URL_DELIMITER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
80
    }
81
82
    public function historyUrl($id)
83
    {
84
        return sprintf('%s%s%s/history', $this->baseUrl(), self::BASE_URL_DELIMITER, $id);
0 ignored issues
show
Bug introduced by
The constant Yaro\Jarboe\Table\CrudTr...ait::BASE_URL_DELIMITER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
85
    }
86
87 1
    public function revertUrl($id)
88
    {
89 1
        return sprintf('%s%s%s/revert', $this->baseUrl(), self::BASE_URL_DELIMITER, $id);
0 ignored issues
show
Bug introduced by
The constant Yaro\Jarboe\Table\CrudTr...ait::BASE_URL_DELIMITER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
90
    }
91
92 62
    public function baseUrl()
93
    {
94 62
        $chunks = explode(self::BASE_URL_DELIMITER, request()->url());
0 ignored issues
show
Bug introduced by
The constant Yaro\Jarboe\Table\CrudTr...ait::BASE_URL_DELIMITER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
95
        $baseUrl = rtrim($chunks[0], '/');
96 62
97
        // TODO:
98
        if (config('jarboe.admin_panel.force_https')) {
99
            $baseUrl = preg_replace('~^http://~', 'https://', $baseUrl);
100
        }
101
102
        return $baseUrl;
103
    }
104
}
105