Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
Factory Class Reference

Public Member Functions

 __construct (\Magento\Framework\ObjectManagerInterface $objectManager)
 
 create ($class=null, $arguments=[])
 

Protected Attributes

 $_objectManager
 
 $_defaultTotalModel = \Magento\Sales\Model\Order\Pdf\Total\DefaultTotal::class
 

Detailed Description

Definition at line 8 of file Factory.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Framework\ObjectManagerInterface  $objectManager)
Parameters
\Magento\Framework\ObjectManagerInterface$objectManager

Definition at line 25 of file Factory.php.

26  {
27  $this->_objectManager = $objectManager;
28  }
$objectManager
Definition: bootstrap.php:17

Member Function Documentation

◆ create()

create (   $class = null,
  $arguments = [] 
)

Create instance of a total model

Parameters
string | null$class
array$arguments
Returns
\Magento\Sales\Model\Order\Pdf\Total\DefaultTotal
Exceptions

Definition at line 38 of file Factory.php.

39  {
41  if (!is_a($class, \Magento\Sales\Model\Order\Pdf\Total\DefaultTotal::class, true)) {
42  throw new \Magento\Framework\Exception\LocalizedException(
43  __(
44  'The PDF total model %1 must be or extend \Magento\Sales\Model\Order\Pdf\Total\DefaultTotal.',
45  $class
46  )
47  );
48  }
49  return $this->_objectManager->create($class, $arguments);
50  }
__()
Definition: __.php:13
$_option $_optionId $class
Definition: date.phtml:13
$arguments

Field Documentation

◆ $_defaultTotalModel

$_defaultTotalModel = \Magento\Sales\Model\Order\Pdf\Total\DefaultTotal::class
protected

Definition at line 20 of file Factory.php.

◆ $_objectManager

$_objectManager
protected

Definition at line 13 of file Factory.php.


The documentation for this class was generated from the following file: