Code Duplication    Length = 23-27 lines in 3 locations

src/Command/Generate/RestCommand.php 1 location

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

src/Command/Generate/CrudCommand.php 1 location

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

src/Command/Generate/GridCommand.php 1 location

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