@@ 29-46 (lines=18) @@ | ||
26 | /** @var EbayEnterprise_Eb2cCore_Model_Config_Registry */ |
|
27 | protected $config; |
|
28 | ||
29 | public function __construct(array $init = []) |
|
30 | { |
|
31 | list( |
|
32 | $this->helper, |
|
33 | $this->coreHelper, |
|
34 | $this->logger, |
|
35 | $this->logContext, |
|
36 | $this->apiLogger, |
|
37 | $this->config, |
|
38 | ) = $this->checkTypes( |
|
39 | $this->nullCoalesce($init, 'helper', Mage::helper('ebayenterprise_giftcard')), |
|
40 | $this->nullCoalesce($init, 'core_helper', Mage::helper('eb2ccore')), |
|
41 | $this->nullCoalesce($init, 'logger', Mage::helper('ebayenterprise_magelog')), |
|
42 | $this->nullCoalesce($init, 'log_context', Mage::helper('ebayenterprise_magelog/context')), |
|
43 | $this->nullCoalesce($init, 'api_logger', new Psr\Log\NullLogger()), |
|
44 | $this->nullCoalesce($init, 'config', null) |
|
45 | ); |
|
46 | } |
|
47 | ||
48 | protected function checkTypes( |
|
49 | EbayEnterprise_GiftCard_Helper_Data $helper, |
@@ 40-65 (lines=26) @@ | ||
37 | * - logger => EbayEnterprise_MageLog_Helper_Data |
|
38 | * - log_context => EbayEnterprise_MageLog_Helper_Context |
|
39 | */ |
|
40 | public function __construct(array $args = []) |
|
41 | { |
|
42 | list( |
|
43 | $this->quantityService, |
|
44 | $this->detailsService, |
|
45 | $this->allocationService, |
|
46 | $this->logger, |
|
47 | $this->logContext, |
|
48 | $this->app |
|
49 | ) = $this->checkTypes( |
|
50 | $this->nullCoalesce( |
|
51 | $args, |
|
52 | 'quantity_service', |
|
53 | Mage::getModel('ebayenterprise_inventory/quantity_service') |
|
54 | ), |
|
55 | $this->nullCoalesce($args, 'details_service', Mage::getModel('ebayenterprise_inventory/details_service')), |
|
56 | $this->nullCoalesce( |
|
57 | $args, |
|
58 | 'allocation_service', |
|
59 | Mage::getModel('ebayenterprise_inventory/allocation_service') |
|
60 | ), |
|
61 | $this->nullCoalesce($args, 'logger', Mage::helper('ebayenterprise_magelog')), |
|
62 | $this->nullCoalesce($args, 'log_context', Mage::helper('ebayenterprise_magelog/context')), |
|
63 | Mage::app() |
|
64 | ); |
|
65 | } |
|
66 | ||
67 | /** |
|
68 | * Enforce type checks on constructor init params. |
@@ 41-58 (lines=18) @@ | ||
38 | * - logger => LoggerInterface |
|
39 | * - log_context => EbayEnterprise_MageLog_Helper_Context |
|
40 | */ |
|
41 | public function __construct(array $args = []) |
|
42 | { |
|
43 | list( |
|
44 | $this->quantitySdkHelper, |
|
45 | $this->quantityHelper, |
|
46 | $this->itemSelection, |
|
47 | $this->logger, |
|
48 | $this->logContext, |
|
49 | $this->inventorySession |
|
50 | ) = $this->checkTypes( |
|
51 | $this->nullCoalesce($args, 'quantity_sdk_helper', Mage::helper('ebayenterprise_inventory/quantity_sdk')), |
|
52 | $this->nullCoalesce($args, 'quantity_helper', Mage::helper('ebayenterprise_inventory/quantity')), |
|
53 | $this->nullCoalesce($args, 'item_selection', Mage::helper('ebayenterprise_inventory/item_selection')), |
|
54 | $this->nullCoalesce($args, 'logger', Mage::helper('ebayenterprise_magelog')), |
|
55 | $this->nullCoalesce($args, 'log_context', Mage::helper('ebayenterprise_magelog/context')), |
|
56 | $this->nullCoalesce($args, 'inventory_session', null) |
|
57 | ); |
|
58 | } |
|
59 | ||
60 | /** |
|
61 | * Enforce type checks on constructor init params. |
@@ 61-77 (lines=17) @@ | ||
58 | * - 'logger' => EbayEnterprise_MageLog_Helper_Data |
|
59 | * - 'context' => EbayEnterprise_MageLog_Helper_Context |
|
60 | */ |
|
61 | public function __construct(array $initParams = array()) |
|
62 | { |
|
63 | list( |
|
64 | $this->selectionHelper, |
|
65 | $this->helper, |
|
66 | $this->coreHelper, |
|
67 | $this->logger, |
|
68 | $this->logContext |
|
69 | ) = $this->checkTypes( |
|
70 | $this->nullCoalesce($initParams, 'selection_helper', Mage::helper('ebayenterprise_paypal/item_selection')), |
|
71 | $this->nullCoalesce($initParams, 'helper', Mage::helper('ebayenterprise_paypal')), |
|
72 | $this->nullCoalesce($initParams, 'core_helper', Mage::helper('eb2ccore')), |
|
73 | $this->nullCoalesce($initParams, 'logger', Mage::helper('ebayenterprise_magelog')), |
|
74 | $this->nullCoalesce($initParams, 'log_context', Mage::helper('ebayenterprise_magelog/context')) |
|
75 | ); |
|
76 | $this->config = $this->helper->getConfigModel(); |
|
77 | } |
|
78 | ||
79 | /** |
|
80 | * Type hinting for self::__construct $initParams |