1 | <?php |
||||
2 | |||||
3 | namespace Someshwer\WorldCountries\Utils; |
||||
4 | |||||
5 | use Illuminate\Encryption\Encrypter; |
||||
0 ignored issues
–
show
|
|||||
6 | use Someshwer\WorldCountries\Data\DataRepository; |
||||
7 | |||||
8 | /** |
||||
9 | * Author: Someshwer Bandapally |
||||
10 | * Date: 14-07-2018. |
||||
11 | * |
||||
12 | * Provides all oceans names |
||||
13 | * |
||||
14 | * Class Oceans |
||||
15 | */ |
||||
16 | trait Oceans |
||||
17 | { |
||||
18 | /** |
||||
19 | * @var DataRepository |
||||
20 | */ |
||||
21 | private $data; |
||||
22 | |||||
23 | /** |
||||
24 | * @var string |
||||
25 | */ |
||||
26 | private $en_key = 'Someshwer1@2#BandapallySomeshwer'; |
||||
27 | |||||
28 | /** |
||||
29 | * @var string |
||||
30 | */ |
||||
31 | private $cipher = 'AES-256-CBC'; |
||||
32 | |||||
33 | /** |
||||
34 | * Oceans constructor. |
||||
35 | * |
||||
36 | * @param DataRepository $dataRepository |
||||
37 | */ |
||||
38 | public function __construct(DataRepository $dataRepository) |
||||
39 | { |
||||
40 | $this->data = $dataRepository; |
||||
41 | } |
||||
42 | |||||
43 | /** |
||||
44 | * Optimize oceans data. |
||||
45 | * |
||||
46 | * @param $all_oceans_data |
||||
47 | * |
||||
48 | * @return string |
||||
49 | */ |
||||
50 | private function optimizeOceansData($all_oceans_data) |
||||
51 | { |
||||
52 | $str_length = strlen($all_oceans_data) - 4; |
||||
53 | $all_oceans_trimmed_data = substr($all_oceans_data, 0, 2).substr($all_oceans_data, 3, $str_length); |
||||
54 | $hash = new Encrypter($this->en_key, $this->cipher); |
||||
55 | |||||
56 | return $hash->decrypt($all_oceans_trimmed_data); |
||||
57 | } |
||||
58 | |||||
59 | /** |
||||
60 | * Returns optimized oceans data. |
||||
61 | * |
||||
62 | * @return string |
||||
63 | */ |
||||
64 | private function getOptimizedOceansData() |
||||
65 | { |
||||
66 | $all_oceans_data = $this->data->oceans(); |
||||
67 | $continents_data = $this->optimizeOceansData($all_oceans_data); |
||||
68 | |||||
69 | return $continents_data; |
||||
70 | } |
||||
71 | |||||
72 | /** |
||||
73 | * Formats oceans data. |
||||
74 | * |
||||
75 | * @param $oceans |
||||
76 | * |
||||
77 | * @return $this |
||||
78 | */ |
||||
79 | private function formatOceans($oceans) |
||||
80 | { |
||||
81 | return collect($oceans)->transform(function ($item) { |
||||
0 ignored issues
–
show
The function
collect 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
![]() |
|||||
82 | $data['name'] = $item; |
||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||
83 | $data['display_name'] = title_case($item); |
||||
0 ignored issues
–
show
The function
title_case 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
![]() |
|||||
84 | $data['also_called_as'] = ($item == 'antarctic') ? 'Southern Ocean' : null; |
||||
85 | |||||
86 | return $data; |
||||
87 | }); |
||||
88 | } |
||||
89 | |||||
90 | /** |
||||
91 | * Returns all oceans names. |
||||
92 | * |
||||
93 | * @return array |
||||
94 | */ |
||||
95 | public function oceans() |
||||
96 | { |
||||
97 | $oceans = $this->getOptimizedOceansData(); |
||||
98 | $formatted_oceans = $this->formatOceans($oceans); |
||||
99 | |||||
100 | return ['oceans' => $formatted_oceans]; |
||||
101 | } |
||||
102 | } |
||||
103 |
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