I have recreate PR from this: https://github.com/piwik/piwik/pull/6146
NOTE: When modifying Piwik core modules, please don't be afraid to modify Piwik core if it improves the architecture of your code or Piwik's. Such changes should be discussed before going into master, but that doesn't mean you can't make them.
Thank you for this proposed pull request.
Because it was last updated more than one month ago, it is our policy to close pull requests opened for a long time without updates. If you would like to continue work on the pull request, please simply ping us to have it re-opened (after you have pushed a new commit).
We hope you understand this and we look forward to seeing an update from you on this pull request or another one!