Code Duplication    Length = 14-16 lines in 3 locations

src/Command/Generate/ModuleCommand.php 1 location

@@ 133-148 (lines=16) @@
130
     * @return void
131
     * @throws GeneratorException
132
     */
133
    public function verify(InputInterface $input, OutputInterface $output)
134
    {
135
        $modulePath = $this->getApplication()->getModulePath($input->getArgument('module'));
136
137
        $paths = [
138
            $modulePath,
139
            $modulePath . DS . 'controllers',
140
            $modulePath . DS . 'views'
141
        ];
142
143
        foreach ($paths as $path) {
144
            if (!$this->getFs()->exists($path)) {
145
                throw new GeneratorException("Directory `$path` is not exists");
146
            }
147
        }
148
    }
149
}
150

src/Command/Generate/RestCommand.php 1 location

@@ 123-136 (lines=14) @@
120
     * @return void
121
     * @throws \Bluzman\Generator\GeneratorException
122
     */
123
    public function verify(InputInterface $input, OutputInterface $output)
124
    {
125
        $modulePath = $this->getApplication()->getModulePath($input->getArgument('module'));
126
127
        $paths = [
128
            $modulePath . DS . 'controllers' . DS . 'rest.php',
129
        ];
130
131
        foreach ($paths as $path) {
132
            if (!$this->getFs()->exists($path)) {
133
                throw new Generator\GeneratorException("File `$path` is not exists");
134
            }
135
        }
136
    }
137
}
138

src/Command/Generate/ModelCommand.php 1 location

@@ 148-162 (lines=15) @@
145
     * @return void
146
     * @throws \Bluzman\Generator\GeneratorException
147
     */
148
    public function verify(InputInterface $input, OutputInterface $output)
149
    {
150
        $modelPath = $this->getApplication()->getModelPath($input->getArgument('model'));
151
152
        $paths = [
153
            $modelPath . DS . 'Table.php',
154
            $modelPath . DS . 'Row.php'
155
        ];
156
157
        foreach ($paths as $path) {
158
            if (!$this->getFs()->exists($path)) {
159
                throw new Generator\GeneratorException("File `$path` is not exists");
160
            }
161
        }
162
    }
163
164
    /**
165
     * @todo move it to DB class