|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* @author : Jagepard <[email protected]"> |
|
7
|
|
|
* @copyright Copyright (c) 2019, Jagepard |
|
8
|
|
|
* @license https://mit-license.org/ MIT |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Rudra\Container\Traits; |
|
12
|
|
|
|
|
13
|
|
|
use Rudra\Pagination; |
|
|
|
|
|
|
14
|
|
|
|
|
15
|
|
|
trait ContainerTrait |
|
16
|
|
|
{ |
|
17
|
|
|
/** |
|
18
|
|
|
* @return mixed |
|
19
|
|
|
*/ |
|
20
|
|
|
public function validation() |
|
21
|
|
|
{ |
|
22
|
|
|
return rudra()->get('validation'); |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @param null $target |
|
|
|
|
|
|
27
|
|
|
* @return mixed |
|
28
|
|
|
*/ |
|
29
|
|
|
public function redirect($target = null) |
|
30
|
|
|
{ |
|
31
|
|
|
return isset($target) ? rudra()->get('redirect')->run($target) : rudra()->get('redirect'); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @param null $key |
|
|
|
|
|
|
36
|
|
|
* @return mixed |
|
37
|
|
|
*/ |
|
38
|
|
|
public function post($key = null) |
|
39
|
|
|
{ |
|
40
|
|
|
return rudra()->request()->post()->get($key); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @param $object |
|
45
|
|
|
* @param null $params |
|
|
|
|
|
|
46
|
|
|
* @return mixed |
|
47
|
|
|
*/ |
|
48
|
|
|
public function new($object, $params = null) |
|
49
|
|
|
{ |
|
50
|
|
|
return rudra()->new($object, $params); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @param string $key |
|
55
|
|
|
* @param string|null $subKey |
|
56
|
|
|
*/ |
|
57
|
|
|
public function unsetSession(string $key, string $subKey = null) |
|
58
|
|
|
{ |
|
59
|
|
|
rudra()->session()->unset($key, $subKey); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @return mixed |
|
64
|
|
|
*/ |
|
65
|
|
|
public function pagination() |
|
66
|
|
|
{ |
|
67
|
|
|
return rudra()->get('pagination'); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @param $page |
|
72
|
|
|
* @param $perPage |
|
73
|
|
|
* @param $numRows |
|
74
|
|
|
*/ |
|
75
|
|
|
public function setPagination($page, $perPage, $numRows): void |
|
76
|
|
|
{ |
|
77
|
|
|
rudra()->set('pagination', new Pagination($page['id'], $perPage, $numRows), 'raw'); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @param string $key |
|
82
|
|
|
* @param string $value |
|
83
|
|
|
* @param string|null $subKey |
|
84
|
|
|
*/ |
|
85
|
|
|
public function setSession(string $key, string $value, string $subKey = null): void |
|
86
|
|
|
{ |
|
87
|
|
|
rudra()->session()->set($key, $value, $subKey); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* @return mixed |
|
92
|
|
|
*/ |
|
93
|
|
|
public function db() |
|
94
|
|
|
{ |
|
95
|
|
|
return rudra()->get('db'); |
|
96
|
|
|
} |
|
97
|
|
|
} |
|
98
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths