| 1 |
<?php |
| 2 |
/** |
| 3 |
* Disco Class File. |
| 4 |
* |
| 5 |
* @package Disco |
| 6 |
* @subpackage Disco\App\Attributes |
| 7 |
* @category MyCategory |
| 8 |
*/ |
| 9 |
|
| 10 |
namespace Disco\App\Intents; |
| 11 |
|
| 12 |
/** |
| 13 |
* Class IntentFactory |
| 14 |
* |
| 15 |
* @package Disco |
| 16 |
* @subpackage Disco\App\Intents |
| 17 |
* @author Ohidul Islam <wahid0003@gmail.com> |
| 18 |
* @link https://webappick.com |
| 19 |
* @license https://opensource.org/licenses/gpl-license.php GNU Public License |
| 20 |
* @category MyCategory |
| 21 |
*/ |
| 22 |
class IntentFactory { |
| 23 |
|
| 24 |
/** |
| 25 |
* This method will return the intent object |
| 26 |
* |
| 27 |
* @param \Disco\App\Utility\Config $campaign Campaign Config. |
| 28 |
* @param array|string|\WP_Error $settings Global Settings. |
| 29 |
* @return bool|object |
| 30 |
*/ |
| 31 |
public static function get_intent( $campaign, $settings ) { |
| 32 |
$class = '\Disco\App\Intents\\' . $campaign->get_discount_intent() . 'Intent'; |
| 33 |
|
| 34 |
if ( ! class_exists( $class ) ) { |
| 35 |
return false; |
| 36 |
} |
| 37 |
|
| 38 |
return new $class( $campaign, $settings ); |
| 39 |
} |
| 40 |
|
| 41 |
} |
| 42 |
|