Total Complexity | 6 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | trait UploadEntityName |
||
13 | { |
||
14 | /** |
||
15 | * Name of file |
||
16 | */ |
||
17 | protected string $name; |
||
18 | |||
19 | /** |
||
20 | * Name of file in kebab case |
||
21 | */ |
||
22 | protected string $nameKebab; |
||
23 | |||
24 | /** |
||
25 | * Specify the method that Larupload should use to name uploaded files. |
||
26 | */ |
||
27 | protected LaruploadNamingMethod $namingMethod; |
||
28 | |||
29 | /** |
||
30 | * Language of file name |
||
31 | */ |
||
32 | protected ?string $lang; |
||
33 | |||
34 | |||
35 | public function getName(bool $withNameStyle = false): string |
||
36 | { |
||
37 | return $withNameStyle ? $this->nameStyle($this->name) : $this->name; |
||
38 | } |
||
39 | |||
40 | public function namingMethod(LaruploadNamingMethod $method): UploadEntities |
||
41 | { |
||
42 | $this->namingMethod = $method; |
||
43 | |||
44 | return $this; |
||
|
|||
45 | } |
||
46 | |||
47 | public function lang(string $lang): UploadEntities |
||
48 | { |
||
49 | $this->lang = $lang; |
||
50 | |||
51 | return $this; |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * Check whether we should convert the name to camel-case style. |
||
56 | */ |
||
57 | protected function nameStyle($name): string |
||
60 | } |
||
61 | } |
||
62 |