1) What have at the beginning?
Let's imagine class "ClassA" which has method "doSomething"
* @param boolean $doStep2
public function doSomething($doStep2)
echo 'doing step one' . PHP_EOL;
echo 'doing step two' . PHP_EOL;
echo 'doing step three' . PHP_EOL;
$object = new ClassA();
Actually "doSomething" implement some code which can be divided into steps(1,2,3)
The second step is optional depending of "doStep2" parameter(but it's irrelevant for idea of this pattern)
2) What want we do?
We want to change step 3.
So let's create new class "ClassB"