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

More dynamic App::set() #20

Open
metawort opened this issue Jun 30, 2016 · 0 comments
Open

More dynamic App::set() #20

metawort opened this issue Jun 30, 2016 · 0 comments

Comments

@metawort
Copy link

I really like your framework, but I stumbled upon the rather redundant code of App::set(). I'd suggest to use something like this instead:

public function set($key, $value) {
    $keys = explode('/',$key);

    if (count($keys)>5) return false;

    $registry =& $this->registry;

    foreach ($keys as $key) {
        $registry =& $registry[$key];
    }

    $registry = $value;

    return $this;
}

That way you also won't have to limit the number of keys (but I kept the limit in case you had good reasons for it ^^).

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

1 participant