Let's imagine that class:
Class Foo {
function1($p1, $p2)
{
do_common_thing1()
specific_1($p1)
specific_2($p2)
do_common_thing2()
}
function2($p1)
{
do_common_thing1()
specific_3($p1)
do_common_thing2()
}
/** ... */
function99()
{
do_common_thing1()
specific_999()
do_common_thing2()
}
}
How can I code the class to avoid repeating the common function in each method? I've heard of the template method pattern but it seems like it can't apply to ALL my methods