Code Duplication    Length = 23-27 lines in 3 locations

src/Command/Generate/CrudCommand.php 1 location

@@ 118-142 (lines=25) @@
115
     * @return void
116
     * @throws \Bluzman\Generator\GeneratorException
117
     */
118
    public function verify(InputInterface $input, OutputInterface $output) : void
119
    {
120
        $model = $input->getArgument('model');
121
        $module = $input->getArgument('module');
122
123
        $modelPath = $this->getApplication()->getModelPath($model);
124
125
        $paths = [
126
            $modelPath . DS . 'Crud.php',
127
        ];
128
129
        foreach ($paths as $path) {
130
            if (!$this->getFs()->exists($path)) {
131
                throw new Generator\GeneratorException("File `$path` is not exists");
132
            }
133
        }
134
135
        $this->write(" |> CRUD for <info>{$model}</info> has been successfully created.");
136
        if ($module) {
137
            $this->write(
138
                " |> <options=bold>Open page <info>/acl</info> in your browser " .
139
                "and set permission <info>Management</info> for <info>{$module}</info> module</>"
140
            );
141
        }
142
    }
143
}
144

src/Command/Generate/GridCommand.php 1 location

@@ 115-141 (lines=27) @@
112
     * @return void
113
     * @throws \Bluzman\Generator\GeneratorException
114
     */
115
    public function verify(InputInterface $input, OutputInterface $output) : void
116
    {
117
        $model = $input->getArgument('model');
118
        $module = $input->getArgument('module');
119
120
        $modelPath = $this->getApplication()->getModelPath($model);
121
122
        $paths = [
123
            $modelPath . DS . 'Grid.php',
124
        ];
125
126
        foreach ($paths as $path) {
127
            if (!$this->getFs()->exists($path)) {
128
                throw new Generator\GeneratorException("File `$path` is not exists");
129
            }
130
        }
131
132
        // notifications
133
        $this->write(" |> GRID for <info>{$model}</info> has been successfully created.");
134
135
        if ($module) {
136
            $this->write(
137
                " |> <options=bold>Open page <info>/acl</info> in your browser " .
138
                "and set permission <info>Management</info> for <info>{$module}</info> module</>"
139
            );
140
        }
141
    }
142
}
143

src/Command/Generate/RestCommand.php 1 location

@@ 97-119 (lines=23) @@
94
     * @return void
95
     * @throws \Bluzman\Generator\GeneratorException
96
     */
97
    public function verify(InputInterface $input, OutputInterface $output) : void
98
    {
99
        $model = $input->getArgument('model');
100
        $module = $input->getArgument('module');
101
102
        $modulePath = $this->getApplication()->getModulePath($module);
103
104
        $paths = [
105
            $modulePath . DS . 'controllers' . DS . 'rest.php',
106
        ];
107
108
        foreach ($paths as $path) {
109
            if (!$this->getFs()->exists($path)) {
110
                throw new Generator\GeneratorException("File `$path` is not exists");
111
            }
112
        }
113
114
        $this->write(" |> REST for <info>{$model}</info> has been successfully created.");
115
        $this->write(
116
            " |> <options=bold>Open page <info>/acl</info> in your browser " .
117
            "and set permissions <info>Management</info> for <info>{$module}</info> module</>"
118
        );
119
    }
120
}
121