Edit: Doesn’t seem like this will help, as I have the ‘duplicated’ code scattered through the plugin.I would have to provide the paths where these strings happen, and that is basically the entire plugin
You could create your own PHP profile, and de-activate the “String literals should not be duplicated” rule. This is what the built-in Drupal profile does, for example (as they have a similar situation).
Go to “Quality Profiles”, filter by PHP
Copy (don’t extend) the Sonar way profile (or PSR-2, or even Drupal – but Sonar way has most default rules)
Edit this new profile, search for the “String literals…” rule, and click on Deactivate
Use this new profile for your project, or you can set it as the default for all PHP code