Code Duplication    Length = 23-27 lines in 3 locations

src/Command/Generate/CrudCommand.php 1 location

@@ 115-139 (lines=25) @@
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 . 'Crud.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
        $this->write(" |> CRUD for <info>{$model}</info> has been successfully created.");
133
        if ($module) {
134
            $this->write(
135
                " |> <options=bold>Open page <info>/acl</info> in your browser ".
136
                "and set permission <info>Management</info> for <info>{$module}</info> module</>"
137
            );
138
        }
139
    }
140
}
141

src/Command/Generate/GridCommand.php 1 location

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

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