Code Duplication    Length = 14-14 lines in 3 locations

src/Command/AbstractCommand.php 2 locations

@@ 194-207 (lines=14) @@
191
     * @return void
192
     * @throws \Bluzman\Input\InputException
193
     */
194
    protected function validateModuleArgument() : void
195
    {
196
        $module = $this->getInput()->getArgument('module');
197
198
        $validator = Validator::create()
199
            ->string()
200
            ->alphaNumeric('-_')
201
            ->noWhitespace();
202
203
        if ($this->getDefinition()->getArgument('module')->isRequired()
204
            && !$validator->validate($module)) {
205
            throw new InputException($validator->getError());
206
        }
207
    }
208
209
    /**
210
     * Add Controller Argument
@@ 227-240 (lines=14) @@
224
     * @return void
225
     * @throws \Bluzman\Input\InputException
226
     */
227
    protected function validateControllerArgument() : void
228
    {
229
        $controller = $this->getInput()->getArgument('controller');
230
231
        $validator = Validator::create()
232
            ->string()
233
            ->alphaNumeric('-_')
234
            ->noWhitespace();
235
236
        if ($this->getDefinition()->getArgument('controller')->isRequired()
237
            && !$validator->validate($controller)) {
238
            throw new InputException($validator->getError());
239
        }
240
    }
241
}
242

src/Command/Generate/AbstractGenerateCommand.php 1 location

@@ 83-96 (lines=14) @@
80
     * @return void
81
     * @throws \Bluzman\Input\InputException
82
     */
83
    protected function validateTableArgument() : void
84
    {
85
        $table = $this->getInput()->getArgument('table');
86
87
        $validator = Validator::create()
88
            ->string()
89
            ->alphaNumeric('_')
90
            ->noWhitespace();
91
92
        if ($this->getDefinition()->getArgument('table')->isRequired()
93
            && !$validator->validate($table)) {
94
            throw new InputException($validator->getError());
95
        }
96
    }
97
98
    /**
99
     * Get Table instance