Danack / Weaver

An experiment in compositional programming
MIT License
0 stars 0 forks source link

Composite weave shouldn't require a holder class #4

Open Danack opened 10 years ago

Danack commented 10 years ago

Currently you have to write a 'holder' class to be able to do a composite with - which is dumb.

You should be able to do it straight from the interface definition.

Danack commented 10 years ago

Done - but interface declaration is missing on the class generated:

class ValueCompositeWithoutHolder
{

    private $email = null;

    private $minLength = null;

    public function __construct(\Example\Composite\Value\Email $email, \Example\Composite\Value\MinLength $minLength)
    {
        $this->email = $email;
        $this->minLength = $minLength;
    }

    public function isValid($value)
    {
        $result = true;
        $result = $result && $this->email->isValid($value);
        $result = $result && $this->minLength->isValid($value);

        return $result;
    }
}

It should have the interface declared.