Design Patterns PHP - Bridge Java

1) What have we done?

We created "ChildAB" and there we inherit after "ChildA"


class ClassAB extends ClassA
{
    public function doB()
    {
        $this->doStep2();
        $this->doStep3();
        $this->doStep1();
    }
}

class ChildAB extends ChildA
{
    public function doB()
    {
        $this->doStep2();
        $this->doStep3();
        $this->doStep1();
    }
}




2) Is it proper situation ?

Unfortunately not, it looks bad, in "ClassAB" and in "ChildAB" we have a code duplication which we can't remove.

But we can use the "Bridge" pattern.

"Bridge" pattern separate implementation from interface.
We just move implementation of "doStep1", "doStep2", "doStep3" to another hierarchy class.