Translations:Developers/Object oriented programming in PHP/Methods/10/en

static methods are mostly used by the factory design pattern. The class TestHelper in lib/mshoplib/tests/ illustrates, how it works. The static method getContext returns the context object stored in a static property and the method also creates a new context object, if it exists not yet: