Design Patterns PHP - Template method Java

1) What have at the beginning?

Let's imagine class "ClassA" which has method "doSomething"

class ClassA
     * @param boolean $doStep2
    public function doSomething($doStep2)
        echo 'doing step one' . PHP_EOL;
        if ($doStep2)
            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"