Design Patterns PHP - Adapter Java

1) What has changed?

Instead of inheritance we used aggregation of object "LibraryTwo" in "Adapter"

2) What hasn't changed?


class Adapter implements LibraryOne
{
    /**
     * @var LibraryTwo $libraryTwo
     */
    protected $libraryTwoInstance;

    function __construct(LibraryTwo $libraryTwoInstance)
    {
        $this->libraryTwoInstance = $libraryTwoInstance;
    }

    public function doAB()
    {
        $this->libraryTwoInstance->doA();
        $this->libraryTwoInstance->doB();
    }
}




Adapter is still type of "LibraryOne" it's necessary condition in order to still use clients without any changes.