| Conditions | 1 |
| Paths | 1 |
| Total Lines | 60 |
| Code Lines | 50 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 25 | protected function configure() |
||
| 26 | { |
||
| 27 | $this |
||
| 28 | ->setName('convert') |
||
| 29 | ->setDescription('Convert Xml file to xmlpipe2 format') |
||
| 30 | ->addArgument( |
||
| 31 | 'file', |
||
| 32 | InputArgument::OPTIONAL, |
||
| 33 | 'Xml file path' |
||
| 34 | ) |
||
| 35 | ->addOption( |
||
| 36 | 'format', |
||
| 37 | null, |
||
| 38 | InputOption::VALUE_OPTIONAL, |
||
| 39 | 'Input Xml Format(google, blank)', |
||
| 40 | 'google' |
||
| 41 | ) |
||
| 42 | ->addOption( |
||
| 43 | 'output', |
||
| 44 | null, |
||
| 45 | InputOption::VALUE_OPTIONAL, |
||
| 46 | 'Output filename', |
||
| 47 | 'stder' |
||
| 48 | ) |
||
| 49 | ->addOption( |
||
| 50 | 'channel', |
||
| 51 | null, |
||
| 52 | InputOption::VALUE_OPTIONAL, |
||
| 53 | 'Channel name for fill channel item field', |
||
| 54 | 'xml' |
||
| 55 | ) |
||
| 56 | ->addOption( |
||
| 57 | 'pretty', |
||
| 58 | null, |
||
| 59 | InputOption::VALUE_OPTIONAL, |
||
| 60 | 'Nicely formats output with indentation and extra space', |
||
| 61 | false |
||
| 62 | ) |
||
| 63 | ->addOption( |
||
| 64 | 'slug', |
||
| 65 | null, |
||
| 66 | InputOption::VALUE_OPTIONAL, |
||
| 67 | 'add sluggables fields - schema based ', |
||
| 68 | false |
||
| 69 | ) |
||
| 70 | ->addOption( |
||
| 71 | 'idField', |
||
| 72 | null, |
||
| 73 | InputOption::VALUE_OPTIONAL, |
||
| 74 | 'Item field to fill document id', |
||
| 75 | 'sku' |
||
| 76 | ) |
||
| 77 | ->addOption( |
||
| 78 | 'idPrefix', |
||
| 79 | null, |
||
| 80 | InputOption::VALUE_OPTIONAL, |
||
| 81 | 'Integer prefix for document id', |
||
| 82 | null |
||
| 83 | ); |
||
| 84 | } |
||
| 85 | |||
| 116 |