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

Collectors configuration #79

Closed
theofidry opened this issue May 2, 2016 · 1 comment
Closed

Collectors configuration #79

theofidry opened this issue May 2, 2016 · 1 comment

Comments

@theofidry
Copy link
Contributor

If I understand correctly from the code, Collectors don't have a configuration per se, but rather have access to all the arguments passed to the collector. As a result, they handle those values as they wish without any validation of any kind.

Example:

// src/Collector/ClassNameCollector.php

private function getRegexByConfiguration(array $configuration)
    {
        if (!isset($configuration['regex'])) {
            throw new \LogicException('ClassNameCollector needs the regex configuration.');
        }

        return $configuration['regex'];
    }

Wouldn't it be better to change that and have one configuration per collector? That way we could add a validation step when creating the collector configuration.

@slde-flash
Copy link
Contributor

yes, this is correct.

this will be definitely changed in the near feature when i start working on #76

right now i don't want to promise that a validation step will be possible. i would prefer a "hackable" configuration over static checks, but i'll do my best to reach both goals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants