SpecialActionFactory.php
35 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Class SpecialActionFactory |
| 4 | * |
| 5 | * @package WPDesk\FS\TableRate\Rule\SpecialAction |
| 6 | */ |
| 7 | |
| 8 | namespace WPDesk\FS\TableRate\Rule\SpecialAction; |
| 9 | |
| 10 | /** |
| 11 | * Can provide special actions. |
| 12 | */ |
| 13 | class SpecialActionFactory { |
| 14 | |
| 15 | /** |
| 16 | * @return SpecialAction[] |
| 17 | */ |
| 18 | public function get_special_actions() { |
| 19 | $none = new None(); |
| 20 | $special_actions = array( |
| 21 | $none->get_special_action_id() => $none, |
| 22 | ); |
| 23 | |
| 24 | $special_actions = apply_filters( 'flexible_shipping_special_actions', $special_actions ); |
| 25 | |
| 26 | return array_filter( |
| 27 | $special_actions, |
| 28 | function ( $special_action ) { |
| 29 | return $special_action instanceof SpecialAction; |
| 30 | } |
| 31 | ); |
| 32 | } |
| 33 | |
| 34 | } |
| 35 |