File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -72,10 +72,27 @@ protected function setAreaCode(): void
72
72
/**
73
73
* @param InputInterface $input
74
74
* @return int[]
75
+ * @throws LocalizedException
75
76
*/
76
77
protected function getStoreIds (InputInterface $ input ): array
77
78
{
78
- return (array ) $ input ->getArgument (self ::STORE_ARGUMENT );
79
+ return $ this ->validateStoreIds ((array ) $ input ->getArgument (self ::STORE_ARGUMENT ));
80
+ }
81
+
82
+ /**
83
+ * @param array $storeIds
84
+ * @return int[]
85
+ * @throws LocalizedException
86
+ */
87
+ protected function validateStoreIds (array $ storeIds ): array
88
+ {
89
+ foreach ($ storeIds as $ storeId ) {
90
+ if (!ctype_digit ($ storeId ) || (int ) $ storeId < 1 ) {
91
+ throw new LocalizedException (__ ("Store ID argument must be an integer " ));
92
+ }
93
+ }
94
+
95
+ return array_map ('intval ' , $ storeIds );
79
96
}
80
97
81
98
protected function getStoreArgumentDefinition (): InputArgument {
You can’t perform that action at this time.
0 commit comments