1 | <?php |
||||
2 | |||||
3 | namespace Spinzar\SignedUrl; |
||||
4 | |||||
5 | use Spatie\UrlSigner\MD5UrlSigner; |
||||
6 | |||||
7 | class SignedUrl extends MD5UrlSigner |
||||
8 | { |
||||
9 | /** |
||||
10 | * The key that is used to generate secure signatures. |
||||
11 | * |
||||
12 | * @var string |
||||
13 | */ |
||||
14 | protected $signatureKey; |
||||
15 | |||||
16 | /** |
||||
17 | * The URL's query parameter name for the expiration. |
||||
18 | * |
||||
19 | * @var string |
||||
20 | */ |
||||
21 | protected $expiresParameter; |
||||
22 | |||||
23 | /** |
||||
24 | * The URL's query parameter name for the signature. |
||||
25 | * |
||||
26 | * @var string |
||||
27 | */ |
||||
28 | protected $signatureParameter; |
||||
29 | |||||
30 | public function __construct() |
||||
31 | { |
||||
32 | $this->signatureKey = config('signed-url.signatureKey'); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
33 | $this->expiresParameter = config('signed-url.parameters.expires'); |
||||
34 | $this->signatureParameter = config('signed-url.parameters.signature'); |
||||
35 | } |
||||
36 | |||||
37 | /** |
||||
38 | * Get a secure URL to a controller action. |
||||
39 | * |
||||
40 | * @param string $url |
||||
41 | * @param \DateTime|int|null $expiration Defaults to the config value |
||||
42 | * |
||||
43 | * @return string |
||||
44 | */ |
||||
45 | public function sign($url, $expiration = null) |
||||
46 | { |
||||
47 | $expiration = $expiration ? $expiration : config('signed-url.default_expiration_time_in_days'); |
||||
0 ignored issues
–
show
The function
config was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
48 | |||||
49 | return parent::sign($url, $expiration); |
||||
50 | } |
||||
51 | } |
||||
52 |