Common/View/ViewBuilder.php
private function initialize(Model\SaleInterface $sale, array $options = [])
    {
        $this->lineNumber = 1;
        $this->view = new SaleView();

        $this->types = $this->registry->getTypesForSale($sale);

        foreach ($this->types as $type) {
            $type->configureOptions($sale, $this->view, $options);
        }

        $this->options = $this->getOptionsResolver()->resolve($options);

        $this->view->setTemplate($this->options['template']);

        if (!is_null($this->options['ati'])) {
            $this->view->setAti($this->options['ati']);
        } else {
            $this->view->setAti($sale->isAtiDisplayMode());
        }

        $this->formatter = $this->formatterFactory->create($this->options['locale'], $sale->getCurrency()->getCode());

        foreach ($this->types as $type) {
            $type->setFormatter($this->formatter);
        }
    }
private function initialize(Model\SaleInterface $sale, array $options = [])
    {
        $this->lineNumber = 1;
        $this->view = new SaleView();

        $this->types = $this->registry->getTypesForSale($sale);

        foreach ($this->types as $type) {
            $type->configureOptions($sale, $this->view, $options);
        }

        $this->options = $this->getOptionsResolver()->resolve($options);

        $this->view->setTemplate($this->options['template']);

        if (!is_null($this->options['ati'])) {
            $this->view->setAti($this->options['ati']);
        } else {
            $this->view->setAti($sale->isAtiDisplayMode());
        }

        $this->formatter = $this->formatterFactory->create($this->options['locale'], $sale->getCurrency()->getCode());

        foreach ($this->types as $type) {
            $type->setFormatter($this->formatter);
        }
    }
Initializes the view builder.

@param Model\SaleInterface $sale
@param array               $options