static method

Intercepting class method invocations using metaclass programmin...

Planet PHP  Sun, 01/22/2012 - 13:52

In Ruby, objects have a handy method called method_missing which allows one to handle method calls for methods that have not been defined.

Most examples out there explain how to implement this in Python using __getattr__, however, none of them (and I mean none) explain how to intercept class method invocations using __metaclass__.

And that’s why I wrote this post.


 

DevArticles.com: Singletons in PHP

PHPDeveloper.org  Tue, 12/06/2011 - 10:17

On DevArticles.com today there's a new tutorial posted talking about one of the more popular design patterns, the Singleton, and how it can be implemented in PHP.


 

Declaring Static Methods in PHP - Lorna Mitchell

Planet PHP  Fri, 12/10/2010 - 02:57

I was confused recently to realise that I had accidentally called a static method in PHP dynamically from another part of my code; I expected PHP to output warnings when this is done.


 

Dependency Injection for static methods - Stubblog - Planet PHP

Planet PHP  Sun, 11/07/2010 - 10:39

Developers who are familiar with the topic of clean code know that static methods are a problem, especially if it comes to testability.

Static makes the code global, and if there is some kind of state involved it is even more a problem because this is global state then - both a maintenance and testability nightmare.


 

Giorgio Sironi's Blog: How to eliminate singletons

PHPDeveloper.org  Thu, 11/19/2009 - 13:05

Giorgio Sironi has posted a two part look at some techniques you can use to eliminate the singletons scattered through out your code (as sparked by the recent announcement that the Zend Framework project will be doing the same thing).