¡@

Home 

php Programming Glossary: dependencies

Error logging, in a smooth way

http://stackoverflow.com/questions/10331084/error-logging-in-a-smooth-way

getLogger Return Object with method 'error' These are the dependencies that are required to use this code. Everyone who wants to re.. who wants to re use this code will have to provide these dependencies. This means that a standard PHP configuration will no longer.. are a standard part of PHP which does not introduce extra dependencies to your code. What to do with them When an exception is thrown..

Use global variables in a class

http://stackoverflow.com/questions/11923272/use-global-variables-in-a-class

same time. And what if you have multiple tightly coupled dependencies Now you are suddenly testing several classes with your so called.. have to worry about getting wrong results because of the dependencies it will also make sure your tests will finish fast. Some people..

Stop using `global` in PHP

http://stackoverflow.com/questions/12445972/stop-using-global-in-php

use SomeClass . So instead of creating implicit invisible dependencies inject all dependencies require 'SomeClass.php' arbitraryConfigVariableName.. of creating implicit invisible dependencies inject all dependencies require 'SomeClass.php' arbitraryConfigVariableName array ..... can be plugged together in any other combination or that dependencies can easily be substituted for others. For example the configuration..

How do I find the mime-type of a file with php?

http://stackoverflow.com/questions/134833/how-do-i-find-the-mime-type-of-a-file-with-php

to return the image mime type. If you don't mind external dependencies you can also check out the excellent getID3 library which can..

ACL implementation

http://stackoverflow.com/questions/3430181/acl-implementation

each controller's method but we don't need any additional dependencies Next approach is to make all controller's methods private and..

PHP global in functions

http://stackoverflow.com/questions/5166087/php-global-in-functions

keyword vs pushing in arguments . When you push in inject dependencies the function does not rely on the outside anymore. When you..

How is testing Registry Pattern or Singleton hard in PHP?

http://stackoverflow.com/questions/5283102/how-is-testing-registry-pattern-or-singleton-hard-in-php

Mocks The good news is you can indeed replace all the dependencies by stubbing or mock them. A test double will pretend to be the..

If Singletons are bad then why is a Service Container good?

http://stackoverflow.com/questions/6034748/if-singletons-are-bad-then-why-is-a-service-container-good

good We all know how bad Singletons are because they hide dependencies and for other reasons . But in a framework there could be many.. Provider as bad as a pure Singleton Service provider hides dependencies too and they just wrap out the creation of the first istance... instead of singletons. PS. I know that to not hide dependencies I should use DI as stated by Misko Add I would add These days..

traits in php ??any real world examples/best practices? [closed]

http://stackoverflow.com/questions/7892749/traits-in-php-any-real-world-examples-best-practices

to hack code into a class it is better to pass in the dependencies via the constructor or via setters class ClassName protected..