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

Introducing HasDefaultOptions Interface #9

Closed
sandrokeil opened this issue Sep 18, 2015 · 2 comments
Closed

Introducing HasDefaultOptions Interface #9

sandrokeil opened this issue Sep 18, 2015 · 2 comments

Comments

@sandrokeil
Copy link
Owner

The configuration described in #8 Introducing HasOptionalOptions Interface has default options.

So why not have an interface which returns the options with default values?

namespace Interop\Config;

interface HasDefaultOptions
{
    /**
     * Returns a list of default options with their values
     *
     * @return string[] List of default options with their values
     */
    public function defaultOptions();
}

Implementation for the configuration looks like

public function defaultOptions()
{
    return [
        'metadata_cache' => 'array',
        'query_cache' => 'array',
        'result_cache' => 'array',
        'hydration_cache' => 'array',
    ];
}

This does not replace the HasOptionalOptions interface, because optional means null (not provided). I think the interface HasOptionalOptions and HasDefaultOptions can be combined.

For this feature the ConfigurationTrait must be updated with an extra interface check. What do you think?

@prolic
Copy link

prolic commented Sep 18, 2015

👍

1 similar comment
@codeliner
Copy link
Contributor

👍

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

3 participants