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

New Config helper #1071

Closed
lonnieezell opened this issue Jun 13, 2018 · 4 comments
Closed

New Config helper #1071

lonnieezell opened this issue Jun 13, 2018 · 4 comments

Comments

@lonnieezell
Copy link
Member

Inspired by #1070:

  • new CodeIgniter\Config\Config class with one public static method: get(). This takes a class name and returns an instance of the class.
  • By default it returns a shared instance, but a new instance can be returned by setting the second parameter to false, just like the Services class.
  • If the config name is fully qualified (Config\App) it will simply try to instantiate/cache and return.
  • If the config name does not include the namespace (App), it will attempt to discover the class similar to way the Services class does, though don't discover and preload all of them, just as requested.
  • new helper method, config() that is just a slightly nicer way of calling CodeIgniter\Config\Config::get().
@puschie286
Copy link
Contributor

first implementation done
should cover all requested aspects
-> documentation missing

i just copy the getClassname function from BaseService, maybe we should move this function to the filelocator ?

another thing is, we should store instances only by class name to avoid storing two instances for name and namspace + name

@lonnieezell
Copy link
Member Author

Sorry for the delay - was on vacation.

i just copy the getClassname function from BaseService, maybe we should move this function to the filelocator ?

Good idea.

another thing is, we should store instances only by class name to avoid storing two instances for name and namespace + name

sounds good

@puschie286
Copy link
Contributor

puschie286 commented Jun 26, 2018

np, me too^^
changes pushed -> next point would be to replace config creation with sharedInstance requests
PS : "The method getClassname() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10" is this settings correct or should i use the codeigniter4-standard ruleset ?

@lonnieezell
Copy link
Member Author

That service hasn't been tweaked to our specific requirements yet. It's just something we're trying out. We don't request changes or block diffs based on that report, so nothing to worry about.

I'll take a look at the PR later today. Thanks.

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