1 | <?php |
||||||
2 | |||||||
3 | namespace OfflineAgency\MongoAutoSync\Traits; |
||||||
4 | |||||||
5 | use DateTime; |
||||||
6 | use Exception; |
||||||
7 | use Illuminate\Http\Request; |
||||||
8 | use MongoDB\BSON\UTCDateTime; |
||||||
9 | |||||||
10 | trait PlainMongoTrait |
||||||
11 | { |
||||||
12 | /** |
||||||
13 | * @param Request $request |
||||||
14 | * @param string $event |
||||||
15 | * @param array $options |
||||||
16 | * |
||||||
17 | * @throws Exception |
||||||
18 | */ |
||||||
19 | public function storeEditAllItems(Request $request, string $event, array $options) |
||||||
0 ignored issues
–
show
|
|||||||
20 | { |
||||||
21 | //Get the item name |
||||||
22 | $items = $this->getItems(); |
||||||
0 ignored issues
–
show
It seems like
getItems() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
23 | |||||||
24 | //Current Obj Create |
||||||
25 | foreach ($items as $key => $item) { |
||||||
26 | $is_ML = isML($item); |
||||||
27 | $is_MD = isMD($item); |
||||||
28 | |||||||
29 | $is_fillable = isFillable($item, $event); |
||||||
30 | $is_skippable = $this->getIsSkippable($request->has($key)); |
||||||
0 ignored issues
–
show
It seems like
getIsSkippable() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
31 | |||||||
32 | if ($is_skippable) { |
||||||
33 | continue; |
||||||
34 | } else { |
||||||
35 | $this->checkRequestExistence( |
||||||
0 ignored issues
–
show
It seems like
checkRequestExistence() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
36 | $request, |
||||||
37 | $key |
||||||
38 | ); |
||||||
39 | } |
||||||
40 | |||||||
41 | if ($is_fillable) { |
||||||
42 | if ($is_ML) { |
||||||
43 | if (is_null($this->$key)) { |
||||||
44 | $old_value = []; |
||||||
45 | } else { |
||||||
46 | $old_value = $this->$key; |
||||||
47 | } |
||||||
48 | $this->$key = ml($old_value, $request->input($key)); |
||||||
49 | } elseif ($is_MD) { |
||||||
50 | if ($request->input($key) == '' || $request->input($key) == null) { |
||||||
51 | $this->$key = null; |
||||||
52 | } else { |
||||||
53 | $this->$key = new UTCDateTime(new DateTime($request->input($key))); |
||||||
54 | } |
||||||
55 | } else { |
||||||
56 | $this->$key = $request->input($key); |
||||||
57 | } |
||||||
58 | } |
||||||
59 | } |
||||||
60 | |||||||
61 | $this->save(); |
||||||
0 ignored issues
–
show
It seems like
save() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
62 | } |
||||||
63 | } |
||||||
64 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.