| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 6 | public function run() { |
||
| 7 | $json = $this->composerJsonObj->jsonData; |
||
| 8 | |||
| 9 | |||
| 10 | if (property_exists($json, 'extra')) { |
||
| 11 | |||
| 12 | GeneralMethods::outputToScreen("<li> already has composer.json </li>"); |
||
| 13 | |||
| 14 | return; |
||
| 15 | } |
||
| 16 | |||
| 17 | else { |
||
| 18 | GeneralMethods::outputToScreen("<li> Adding 'extra' array to composer.json </li>"); |
||
| 19 | |||
| 20 | $json->extra = (object)array('installer-name' => str_replace('silverstripe-', '', $this->composerJsonObj->moduleName)); |
||
| 21 | } |
||
| 22 | |||
| 23 | |||
| 24 | } |
||
| 25 | } |
||
| 26 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.