src/Composition.php
public function compile()
    {
        if (!$this->isCompiled()) {
            $this->stack = [$this];
            $len = count($this->attributes);
            for ($i = $len - 1; $i >= 0; $i--) {
                $next = $this->stack[0];
                $handler = $this->attributes[$i];
                array_unshift($this->stack, function () use ($next, $handler) {
                    call_user_func($handler, $this->context, $next);
                    return $this->context;
                });
            }
        }

        return $this;
    }
public function compile()
    {
        if (!$this->isCompiled()) {
            $this->stack = [$this];
            $len = count($this->attributes);
            for ($i = $len - 1; $i >= 0; $i--) {
                $next = $this->stack[0];
                $handler = $this->attributes[$i];
                array_unshift($this->stack, function () use ($next, $handler) {
                    call_user_func($handler, $this->context, $next);
                    return $this->context;
                });
            }
        }

        return $this;
    }
Compile composition

@return Composition