1
|
|
|
<?php namespace Arcanedev\LaravelSeo\Entities; |
2
|
|
|
|
3
|
|
|
use Arcanedev\LaravelSeo\Seo; |
4
|
|
|
use Symfony\Component\HttpFoundation\Response; |
5
|
|
|
|
6
|
|
|
/** |
7
|
|
|
* Class RedirectStatuses |
8
|
|
|
* |
9
|
|
|
* @package Arcanedev\LaravelSeo\Entities |
10
|
|
|
* @author ARCANEDEV <[email protected]> |
11
|
|
|
*/ |
12
|
|
|
class RedirectStatuses |
13
|
|
|
{ |
14
|
|
|
/* ----------------------------------------------------------------- |
15
|
|
|
| Main Methods |
16
|
|
|
| ----------------------------------------------------------------- |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Get the all status codes. |
21
|
|
|
* |
22
|
|
|
* @return \Illuminate\Support\Collection |
23
|
|
|
*/ |
24
|
10 |
|
public static function keys() |
25
|
|
|
{ |
26
|
10 |
|
return collect([ |
27
|
10 |
|
Response::HTTP_MOVED_PERMANENTLY, |
28
|
10 |
|
Response::HTTP_SEE_OTHER, |
29
|
10 |
|
Response::HTTP_TEMPORARY_REDIRECT, |
30
|
10 |
|
Response::HTTP_PERMANENTLY_REDIRECT, |
31
|
|
|
]); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Get the all status names. |
36
|
|
|
* |
37
|
|
|
* @param string|null $locale |
38
|
|
|
* |
39
|
|
|
* @return \Illuminate\Support\Collection |
40
|
|
|
*/ |
41
|
|
|
public static function all($locale = null) |
42
|
|
|
{ |
43
|
8 |
|
return static::keys()->mapWithKeys(function ($code) use ($locale) { |
44
|
8 |
|
return [$code => Seo::getTrans("redirections.statuses.{$code}", [], $locale)]; |
45
|
8 |
|
}); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Get the status name. |
50
|
|
|
* |
51
|
|
|
* @param int $key |
52
|
|
|
* @param string|null $default |
53
|
|
|
* @param string|null $locale |
54
|
|
|
* |
55
|
|
|
* @return string |
56
|
|
|
*/ |
57
|
4 |
|
public static function get($key, $default = null, $locale = null) |
58
|
|
|
{ |
59
|
4 |
|
return static::all($locale)->get($key, $default); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|