@@ 27-42 (lines=16) @@ | ||
24 | * @return PaymentMethodInterface |
|
25 | */ |
|
26 | ||
27 | public function setPaymentMethod($method) |
|
28 | { |
|
29 | ||
30 | // If we are passed just the class name we will prepend it with Magium\Magento\Actions\Checkout\PaymentMethods |
|
31 | if (strpos($method, '\\') === false) { |
|
32 | $method = 'Checkout\PaymentMethods\\' . $method; |
|
33 | $method = self::resolveClass($method, 'Actions'); |
|
34 | } |
|
35 | $reflection = new \ReflectionClass($method); |
|
36 | if ($reflection->implementsInterface('Magium\Magento\Actions\Checkout\PaymentMethods\PaymentMethodInterface')) { |
|
37 | ||
38 | $this->setTypePreference('Magium\Magento\Actions\Checkout\PaymentMethods\PaymentMethodInterface', $method); |
|
39 | } else { |
|
40 | throw new InvalidConfigurationException('The payment method must implement Magium\Magento\Actions\Checkout\PaymentMethods\PaymentMethodInterface'); |
|
41 | } |
|
42 | } |
|
43 | ||
44 | /** |
|
45 | * @return PaymentMethodInterface |
|
@@ 79-92 (lines=14) @@ | ||
76 | * @return \Magium\Magento\Actions\Checkout\ShippingMethods\ShippingMethodInterface |
|
77 | */ |
|
78 | ||
79 | public function setShippingMethod($method) |
|
80 | { |
|
81 | ||
82 | // When just the class name is passed we will prepend it with Magium\Magento\Actions\Checkout\PaymentMethods |
|
83 | if (strpos($method, '\\') === false) { |
|
84 | $method = 'Magium\Magento\Actions\Checkout\ShippingMethods\\' . $method; |
|
85 | } |
|
86 | $reflection = new \ReflectionClass($method); |
|
87 | if ($reflection->implementsInterface('Magium\Magento\Actions\Checkout\ShippingMethods\ShippingMethodInterface')) { |
|
88 | $this->setTypePreference('Magium\Magento\Actions\Checkout\ShippingMethods\ShippingMethodInterface', $method); |
|
89 | } else { |
|
90 | throw new InvalidConfigurationException('The payment method must implement Magium\Magento\Actions\Checkout\ShippingMethods\ShippingMethodInterface'); |
|
91 | } |
|
92 | } |
|
93 | ||
94 | /** |
|
95 | * @return ShippingMethodInterface |