Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor] Create symfony console helper class to process and validate common Piwik console input #8844

Closed
diosmosis opened this issue Sep 23, 2015 · 0 comments
Labels
wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.

Comments

@diosmosis
Copy link
Member

In Piwik commands, it is common to specify one or more sites, dates, periods, etc. Getting and processing this data takes some work which results in many commands containing similar, redundant code.

To remove this code redundancy and to better test this code outside of testing commands themselves, we can introduce a new symfony helper for Piwik specific stuff.

It could, for example, look like this:

class PiwikCommandHelper implements HelperInterface
{
    public function getIdSites($value)
    {
        // ... turn $value into list of ints, check the current user has access and that the sites exist ...
    }
}

and be used like this:

protected function execute(InputInterface $input, OutputInterface $output)
{
    $idSites = $this->getHelper('piwik')->getIdSites($input->getOption('sites'));

    // ...
}

If this logic is common w/ API method input processing and/or other places, we can make the utility more generic. Though it could still implement HelperInterface...

@diosmosis diosmosis added this to the Short term milestone Sep 23, 2015
@mattab mattab closed this as completed Jul 8, 2016
@mattab mattab added the wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it. label Jul 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Projects
None yet
Development

No branches or pull requests

2 participants