| Conditions | 16 |
| Paths | > 20000 |
| Total Lines | 54 |
| Code Lines | 36 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 54 | public function __construct(array $features = []) |
||
| 55 | { |
||
| 56 | parent::__construct(); |
||
| 57 | |||
| 58 | $this->features = array_merge($this->features, $features); |
||
| 59 | |||
| 60 | if (!$this->features['header']) { |
||
| 61 | unset($this->block_gamut['doHeaders']); |
||
| 62 | } |
||
| 63 | if (!$this->features['list']) { |
||
| 64 | unset($this->block_gamut['doLists']); |
||
| 65 | } |
||
| 66 | if (!$this->features['horizontal_rule']) { |
||
| 67 | unset($this->block_gamut['doHorizontalRules']); |
||
| 68 | } |
||
| 69 | if (!$this->features['table']) { |
||
| 70 | unset($this->block_gamut['doTables']); |
||
| 71 | } |
||
| 72 | if (!$this->features['foot_note']) { |
||
| 73 | unset($this->document_gamut['stripFootnotes']); |
||
| 74 | unset($this->document_gamut['appendFootnotes']); |
||
| 75 | unset($this->span_gamut['doFootnotes']); |
||
| 76 | } |
||
| 77 | if (!$this->features['fenced_code_block']) { |
||
| 78 | unset($this->document_gamut['doFencedCodeBlocks']); |
||
| 79 | unset($this->block_gamut['doFencedCodeBlocks']); |
||
| 80 | } |
||
| 81 | if (!$this->features['abbreviation']) { |
||
| 82 | unset($this->document_gamut['stripAbbreviations']); |
||
| 83 | unset($this->span_gamut['doAbbreviations']); |
||
| 84 | } |
||
| 85 | if (!$this->features['definition_list']) { |
||
| 86 | unset($this->block_gamut['doDefLists']); |
||
| 87 | } |
||
| 88 | if (!$this->features['reference_link']) { |
||
| 89 | unset($this->document_gamut['stripLinkDefinitions']); |
||
| 90 | } |
||
| 91 | if (!$this->features['images']) { |
||
| 92 | unset($this->span_gamut['doImages']); |
||
| 93 | } |
||
| 94 | if (!$this->features['block_quote']) { |
||
| 95 | unset($this->block_gamut['doBlockQuotes']); |
||
| 96 | } |
||
| 97 | if (!$this->features['code_block']) { |
||
| 98 | unset($this->block_gamut['doCodeBlocks']); |
||
| 99 | } |
||
| 100 | if (!$this->features['auto_link']) { |
||
| 101 | unset($this->span_gamut['doAutoLinks']); |
||
| 102 | } |
||
| 103 | if (false === $this->features['entities']) { |
||
| 104 | $this->no_entities = true; |
||
| 105 | } |
||
| 106 | if (true === $this->features['no_html']) { |
||
| 107 | $this->no_markup = true; |
||
| 108 | } |
||
| 253 |