1 <?php
2
3 /* --------------------------------------------------------------
4 ProductFactory.inc.php 2016-01-18
5 Gambio GmbH
6 http://www.gambio.de
7 Copyright (c) 2016 Gambio GmbH
8 Released under the GNU General Public License (Version 2)
9 [http://www.gnu.org/licenses/gpl-2.0.html]
10 --------------------------------------------------------------
11 */
12
13
14 /**
15 * Class ProductFactory
16 *
17 * @category System
18 * @package Product
19 * @subpackage Factories
20 */
21 class ProductFactory implements ProductFactoryInterface
22 {
23 /**
24 * Creates a product.
25 *
26 * @return GXEngineProduct The created product.
27 */
28 public function createProduct()
29 {
30 $settings = $this->createProductSettings();
31
32 return MainFactory::create('GXEngineProduct', $settings);
33 }
34
35
36 /**
37 * Creates a stored product.
38 *
39 * @param IdType $productId Product ID.
40 *
41 * @return StoredProduct
42 */
43 public function createStoredProduct(IdType $productId)
44 {
45 return MainFactory::create('StoredProduct', $productId, MainFactory::create('ProductSettings'));
46 }
47
48
49 /**
50 * Creates a product settings container.
51 *
52 * @return ProductSettings
53 */
54 public function createProductSettings()
55 {
56 return MainFactory::create('ProductSettings');
57 }
58 }