Design Patterns PHP - Facade Java

1) What have we done?

We just created "Facade" object and we use in this class intefaces of all 3 classes


class Facade
{
    /**
     * @param $string
     * @return string
     */
    public function getNeededObject($string)
    {
        $a = new ClassA($string);
        $b = new ClassB();
        $c = new ClassC();

        $a->doA();
        $b->setB($a->getA());
        $b->doB();
        $c->doC($b);

        return $c->getC();
    }
}




2) What have we achieved?

We just noticeable simplify interface for the client.
Now client doesn't have to know details of which class are used(ClassA, ClassB, ClassC) and relations between them.


$facade = new Facade();
$neededObj = $facade->getNeededObject('something');