EntityFromYamlGenerator   B
last analyzed

Complexity

Total Complexity 45

Size/Duplication

Total Lines 344
Duplicated Lines 42.15 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 97.42%

Importance

Changes 0
Metric Value
dl 145
loc 344
ccs 189
cts 194
cp 0.9742
rs 8.3673
c 0
b 0
f 0
wmc 45
lcom 1
cbo 5

12 Methods

Rating   Name   Duplication   Size   Complexity  
A getHeader() 9 9 1
F start() 47 102 15
B initFildset() 37 37 1
B getEntityList() 0 25 6
A getPluginList() 15 15 4
A toCamelCase() 0 6 1
B makeRepository() 0 35 1
B makeMigration() 34 34 5
A createEntityList() 0 8 2
A getShortClassName() 0 4 1
B makeCreateParts() 3 37 6
A makeDropParts() 0 9 2

How to fix   Duplicated Code    Complexity   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

Complex Class

 Tip:   Before tackling complexity, make sure that you eliminate any duplication first. This often can reduce the size of classes significantly.

Complex classes like EntityFromYamlGenerator often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use EntityFromYamlGenerator, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.lockon.co.jp/
9
 *
10
 * This program is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU General Public License
12
 * as published by the Free Software Foundation; either version 2
13
 * of the License, or (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program; if not, write to the Free Software
22
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23
 */
24
25
namespace Eccube\Command\PluginCommand;
26
27
use Symfony\Component\Yaml\Yaml;
28
use Eccube\Command\PluginCommand\AbstractPluginGenerator;
29
use Eccube\Doctrine\ORM\Mapping\Driver\YamlDriver;
30
use Doctrine\DBAL\Types\Type;
31
use Doctrine\ORM\Mapping\ClassMetadataInfo;
32
use Doctrine\ORM\Tools\EntityGenerator;
33
34
class EntityFromYamlGenerator extends AbstractPluginGenerator
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
35
{
36
37
    const PLUGIN_PREFIX = 'plg_';
38
39
    /**
40
     * Entityリスト
41
     * @var array
42
     */
43
    private $entityList = null;
44
45 1 View Code Duplication
    protected function getHeader()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
46
    {
47 1
        $this->output->writeln('------------------------------------------------------');
48 1
        $this->output->writeln('---Plugin Generator for Entity');
49 1
        $this->output->writeln('---[*] You need to create yaml file first.');
50 1
        $this->output->writeln('---[*]You can exit from Console Application, by typing ' . self::STOP_PROCESS . ' instead of typing another word.');
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
51 1
        $this->output->writeln('------------------------------------------------------');
52 1
        $this->output->writeln('');
53
    }
54
55 1
    protected function start()
56
    {
57
        $fsList = array(
58 1
            'dir' => array(),
59
            'file' => array(),
60
        );
61
62 1
        $pluginCode = $this->paramList['pluginCode']['value'];
63 1
        $yamlList = $this->paramList['entityList']['value'];
64
65 1
        $codePath = $this->app['config']['root_dir'] . '/app/Plugin/' . $pluginCode;
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
66
67 1
        $dirList = array('Entity', 'Repository', '/Resource/doctrine/migration');
68 1 View Code Duplication
        foreach ($dirList as $dirName) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
69 1
            $dirPath = $codePath . '/' . $dirName;
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
70 1
            if (!is_dir($dirPath)) {
71 1
                mkdir($dirPath);
72
            }
73 1
            if (is_dir($dirPath)) {
74 1
                $fsList['dir'][$dirPath] = true;
75
            } else {
76 1
                $fsList['dir'][$dirPath] = false;
77
            }
78
        }
79 1
        $metadetas = array();
80
81
82 1
        $YamlDriver = new YamlDriver(array($codePath . '/Resource/doctrine'));
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
83 1
        foreach ($yamlList as $pathYaml => $fullClassName) {
0 ignored issues
show
Coding Style introduced by
Blank line found at start of control structure
Loading history...
84
85 1
            $MetadataInfo = new ClassMetadataInfo($fullClassName);
86 1
            $YamlDriver->loadMetadataForClass($fullClassName, $MetadataInfo);
87 1
            $metadetas[] = $MetadataInfo;
88
89
            //Entity作成
90 1
            $EntityGenerator = new EntityGenerator();
91 1
            $EntityGenerator->setBackupExisting(false);
92 1
            $EntityGenerator->setClassToExtend('Eccube\\Entity\\AbstractEntity');
93 1
            $EntityGenerator->setGenerateAnnotations(false);
94 1
            $EntityGenerator->setRegenerateEntityIfExists(true);
95 1
            $EntityGenerator->setGenerateStubMethods(true);
96 1
            $EntityGenerator->setUpdateEntityIfExists(false);
97
98 1
            $pathClass = $this->app['config']['root_dir'] . '/app/';
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
99 1
            $EntityGenerator->generate(array($MetadataInfo), $pathClass);
100 1
            $pathClass .= str_replace('\\', DIRECTORY_SEPARATOR, $MetadataInfo->name) . '.php';
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
101 1 View Code Duplication
            if (is_file($pathClass)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
102 1
                $fsList['file'][$pathClass] = true;
103
            } else {
104
                $fsList['file'][$pathClass] = false;
105
            }
106
107
            //Repository作成
108 1
            $filename = $this->makeRepository($pluginCode, $MetadataInfo);
109 1 View Code Duplication
            if (is_file($filename)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
110 1
                $fsList['file'][$filename] = true;
111
            } else {
112 1
                $fsList['file'][$filename] = false;
113
            }
114
        }
115
116
        //Migration作成
117 1
        if (count($metadetas)) {
118 1
            $migrationContent = $this->makeMigration($pluginCode, $metadetas);
119 1
            $timeSt = date('YmdHis');
120 1
            $migrationContent = str_replace('[datetime]', $timeSt, $migrationContent);
121 1
            $migPath = $codePath . '/Resource/doctrine/migration/Version' . $timeSt . '.php';
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
122
123 1
            file_put_contents($migPath, $migrationContent);
124 1 View Code Duplication
            if (is_file($migPath)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
125 1
                $fsList['file'][$migPath] = true;
126
            } else {
127
                $fsList['file'][$migPath] = false;
128
            }
129
        }
130
131 1
        $dirFileNg = array();
132 1
        $dirFileOk = array();
133 1 View Code Duplication
        foreach ($fsList['dir'] as $path => $flag) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
134 1
            if ($flag) {
135 1
                $dirFileOk[] = $path;
136
            } else {
137 1
                $dirFileNg[] = $path;
138
            }
139
        }
140 1 View Code Duplication
        foreach ($fsList['file'] as $path => $flag) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
141 1
            if ($flag) {
142 1
                $dirFileOk[] = $path;
143
            } else {
144 1
                $dirFileNg[] = $path;
145
            }
146
        }
147 1
        $this->output->writeln('');
148 1
        $this->output->writeln('[+]file system');
149 1 View Code Duplication
        if (!empty($dirFileOk)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
150 1
            $this->output->writeln('');
151 1
            $this->output->writeln(' this files and folders were created.');
152 1
            foreach ($dirFileOk as $path) {
153 1
                $this->output->writeln('<info> - ' . $path . '</info>');
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
154
            }
155
        }
156
    }
157
158 1 View Code Duplication
    protected function initFildset()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
159
    {
160 1
        $this->paramList = array(
0 ignored issues
show
introduced by
Add a comma after each item in a multi-line array
Loading history...
161
            'pluginCode' => array(
0 ignored issues
show
introduced by
Add a comma after each item in a multi-line array
Loading history...
162 1
                'no' => 1,
163 1
                 'label' => '[+]Plugin Code: ',
164
                'value' => null,
165 1
                'name' => '[+]Please enter Plugin Name (only pascal case letters numbers are allowed)',
166
                'validation' => array(
0 ignored issues
show
introduced by
Add a comma after each item in a multi-line array
Loading history...
167
                    'isRequired' => true,
168 1
                    'inArray' => $this->getPluginList()
169
                )
170 1
            ),
171
            'entityList' => array(
0 ignored issues
show
introduced by
Add a comma after each item in a multi-line array
Loading history...
172
                'no' => 2,
173
                'label' => '[+]Yaml file name: ',
174
                'value' => array(),
175
                'name' => '[+]Plese enter yaml file name',
176
                'validation' => array(
0 ignored issues
show
introduced by
Add a comma after each item in a multi-line array
Loading history...
177
                    'isRequired' => false,
178
                    'inArray' => 'getEntityList'
179
                )
180
            ),
181
            'supportFlag' => array(
0 ignored issues
show
introduced by
Add a comma after each item in a multi-line array
Loading history...
182
                'no' => 3,
183
                'label' => '[+]Old version support: ',
184
                'value' => null,
185
                'name' => '[+]Do you want to support old versions too? [y/n]',
186
                'show' => array(
0 ignored issues
show
introduced by
Add a comma after each item in a multi-line array
Loading history...
187
                    1 => 'Yes', 0 => 'No'),
188
                'validation' => array(
0 ignored issues
show
introduced by
Add a comma after each item in a multi-line array
Loading history...
189
                    'isRequired' => true,
190
                    'choice' => array('y' => 1, 'n' => 0)
191
                )
192
            )
193
        );
194
    }
195
196 1
    protected function getEntityList()
197
    {
198 1
        if (!$this->paramList['pluginCode']['value']) {
199
            return array();
200
        }
201
202 1
        if ($this->entityList === null) {
203 1
            $this->entityList = array();
204 1
            $directory = $this->app['config']['root_dir'] . '/app/Plugin/' . $this->paramList['pluginCode']['value'] . '/Resource/doctrine/';
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
205 1
            if (!is_dir($directory)) {
206
                return $this->entityList;
207
            }
208 1
            $dirListing = array_diff(scandir($directory), array('..', '.'));
209 1
            $ext = YamlDriver::DEFAULT_FILE_EXTENSION;
210 1
            $revCount = strlen($ext) * -1;
211 1
            foreach ($dirListing as $fileName) {
212 1
                if (substr($fileName, $revCount) == $ext) {
213 1
                    $className = str_replace('.', '\\', str_replace($ext, '', $fileName));
214 1
                    $this->entityList[$fileName] = $className;
215
                }
216
            }
217
        }
218
219 1
        return $this->entityList;
220
    }
221
222 1 View Code Duplication
    private function getPluginList()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
223
    {
224 1
        $ret = array();
225 1
        $pluginDir = $this->app['config']['root_dir'] . '/app/Plugin';
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
226 1
        $iterator = new \DirectoryIterator($pluginDir);
227 1
        foreach ($iterator as $fileInfo) {
228 1
            if ($fileInfo->isDot()) {
229 1
                continue;
230
            }
231 1
            if ($fileInfo->isDir()) {
232 1
                $ret[$fileInfo->getFilename()] = $fileInfo->getFilename();
233
            }
234
        }
235 1
        return $ret;
0 ignored issues
show
introduced by
Missing blank line before return statement
Loading history...
236
    }
237
238
    private function toCamelCase($name)
239
    {
240 1
        return lcfirst(implode('', array_map(function ($name) {
241 1
                    return ucfirst($name);
242 1
                }, explode('_', $name))));
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 8 spaces, but found 16.
Loading history...
Coding Style introduced by
Closing brace indented incorrectly; expected 8 spaces, found 16
Loading history...
243
    }
244
245 1
    private function makeRepository($pluginCode, $metadata)
246
    {
247 1
        $nameFormated = ucfirst($this->getShortClassName($metadata->table['name']));
248
249 1
        $line = array();
250 1
        $line[] = '<?php';
251 1
        $line[] = '/*';
252 1
        $line[] = ' * This file is part of ' . $pluginCode;
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
253 1
        $line[] = ' *';
254 1
        $line[] = ' *';
255 1
        $line[] = ' * For the full copyright and license information, please view the LICENSE';
256 1
        $line[] = ' * file that was distributed with this source code.';
257 1
        $line[] = ' */';
258 1
        $line[] = '';
259 1
        $line[] = 'namespace Plugin\\' . $pluginCode . '\Repository;';
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
260 1
        $line[] = '';
261 1
        $line[] = 'use Doctrine\ORM\EntityRepository;';
262 1
        $line[] = '';
263 1
        $line[] = '/**';
264 1
        $line[] = ' * ' . $nameFormated;
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
265 1
        $line[] = ' *';
266 1
        $line[] = ' * This class was generated by the Doctrine ORM. Add your own custom';
267 1
        $line[] = ' * repository methods below.';
268 1
        $line[] = ' */';
269 1
        $line[] = 'class ' . $nameFormated . 'Repository extends EntityRepository';
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
270 1
        $line[] = '{';
271 1
        $line[] = '';
272 1
        $line[] = '}';
273 1
        $line[] = '';
274
275 1
        $cont = join(PHP_EOL, $line);
276 1
        $filename = $this->app['config']['root_dir'] . '/app/Plugin/' . $pluginCode . '/Repository/' . $nameFormated . 'Repository.php';
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
277 1
        file_put_contents($filename, $cont);
278 1
        return $filename;
0 ignored issues
show
introduced by
Missing blank line before return statement
Loading history...
279
    }
280
281 1 View Code Duplication
    private function makeMigration($pluginCode, $metadetas)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
282
    {
283 1
        if ($this->paramList['supportFlag']['value']) {
284 1
            $migrationFileCont = file_get_contents($this->app['config']['root_dir'] . '/src/Eccube/Command/PluginCommand/Resource/MigrationVersionSupport.php');
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
285
        } else {
286
            $migrationFileCont = file_get_contents($this->app['config']['root_dir'] . '/src/Eccube/Command/PluginCommand/Resource/MigrationVersion.php');
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
287
        }
288
289 1
        $entityList = $this->createEntityList($pluginCode, $metadetas);
290
291 1
        $entityListStr = join(',' . PHP_EOL, $entityList);
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
292 1
        $migrationFileCont = str_replace('[entityList]', $entityListStr, $migrationFileCont);
293 1
        if ($this->paramList['supportFlag']['value']) {
294 1
            $createParts = $this->makeCreateParts($metadetas);
295 1
            $tableNameArr = array();
296 1
            foreach ($createParts as $tableName => $tableArr) {
297 1
                $tableNameArr[] = '            $this->createTable' . $tableName . '($schema);';
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
298
            }
299 1
            $tableNameStr = join(PHP_EOL, $tableNameArr);
300 1
            $migrationFileCont = str_replace('[createTable]', $tableNameStr, $migrationFileCont);
301
302 1
            $createPartsStr = '';
303 1
            foreach ($createParts as $parts) {
304 1
                $createPartsStr .= join(PHP_EOL, $parts);
305
            }
306 1
            $migrationFileCont = str_replace('[createFunction]', $createPartsStr, $migrationFileCont);
307
308 1
            $dropParts = $this->makeDropParts($metadetas);
309 1
            $dropPartsStr = join(PHP_EOL, $dropParts);
310 1
            $migrationFileCont = str_replace('[dropTable]', $dropPartsStr, $migrationFileCont);
311
        }
312
313 1
        return $migrationFileCont;
314
    }
315
316 1
    private function createEntityList($pluginCode, $migrations)
317
    {
318 1
        $ret = array();
319 1
        foreach ($migrations as $metadata) {
320 1
            $ret[] = "        '" . 'Plugin\\' . $pluginCode . '\Entity\\' . ucfirst($this->getShortClassName($metadata->table['name'])) . "'";
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
321
        }
322 1
        return $ret;
0 ignored issues
show
introduced by
Missing blank line before return statement
Loading history...
323
    }
324
325 1
    private function getShortClassName($dbTableName)
326
    {
327 1
        return $this->toCamelCase(str_replace(self ::PLUGIN_PREFIX, '', $dbTableName));
328
    }
329
330 1
    private function makeCreateParts($metadetas)
331
    {
332 1
        $ret = array();
333 1
        foreach ($metadetas as $metadata) {
0 ignored issues
show
Coding Style introduced by
Blank line found at start of control structure
Loading history...
334
335 1
            $nameFormated = $this->getShortClassName($metadata->table['name']);
336 1
            $tmp = array();
337 1
            $tmp[] = '';
338 1
            $tmp[] = '    public function createTable' . ucfirst($nameFormated) . '(Schema $schema)';
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
339 1
            $tmp[] = '    {';
340 1
            $tmp[] = '        $table = $schema->createTable(\'' . $metadata->table['name'] . '\');';
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
341 1
            $columns = $metadata->fieldMappings;
342 1
            foreach ($columns as $column) {
0 ignored issues
show
Coding Style introduced by
Blank line found at start of control structure
Loading history...
343
344 1
                $typeName = $column['type'];
345 1
                $tmp[] = '        $table->addColumn(\'' . $column['columnName'] . '\', \'' . $typeName . '\', array(';
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
346 1
                $param = array();
347 1
                if (isset($column['nullable']) && $column['nullable']) {
348 1
                    $param['notnull'] = 'true';
349
                } else {
350 1
                    $param['notnull'] = 'false';
351
                }
352
353 1 View Code Duplication
                foreach ($param as $parKey => $parVal) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
354 1
                    $tmp[] = '            \'' . $parKey . '\' => ' . $parVal . ',';
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
355
                }
356 1
                $tmp[] = '        ));';
357
            }
358
359
360 1
            $tmp[] = '    }';
361 1
            $tmp[] = '';
362 1
            $ret[ucfirst($nameFormated)] = $tmp;
363
        }
364
365 1
        return $ret;
366
    }
367
368 1
    private function makeDropParts($metadetas)
369
    {
370 1
        $ret = array();
371 1
        foreach ($metadetas as $metadata) {
372 1
            $ret[] = '            $schema->dropTable(\'' . $metadata->table['name'] . '\');';
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
373
        }
374
375 1
        return $ret;
376
    }
377
}
378