1 <?php
2
3 /* --------------------------------------------------------------
4 CategoryFactory.inc.php 2015-11-20 gm
5 Gambio GmbH
6 http://www.gambio.de
7 Copyright (c) 2015 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 MainFactory::load_class('CategoryFactoryInterface');
14
15 /**
16 * Class CategoryFactory
17 *
18 * This class creates Category and StoredCategory objects with its CategorySettings dependency.
19 *
20 * @category System
21 * @package Category
22 * @subpackage Factories
23 */
24 class CategoryFactory implements CategoryFactoryInterface
25 {
26 /**
27 * Creates and returns a new instance of a category object.
28 *
29 * @return Category
30 */
31 public function createCategory()
32 {
33 return MainFactory::create('Category', MainFactory::create('CategorySettings'));
34 }
35
36
37 /**
38 * Creates and returns a new instance of a stored category object.
39 *
40 * @param IdType $categoryId CategoryID.
41 *
42 * @return StoredCategory
43 */
44 public function createStoredCategory(IdType $categoryId)
45 {
46 return MainFactory::create('StoredCategory', $categoryId, MainFactory::create('CategorySettings'));
47 }
48
49
50 /**
51 * Creates and returns a new instance of a category settings object.
52 *
53 * @return CategorySettings
54 */
55 public function createCategorySettings()
56 {
57 return MainFactory::create('CategorySettings');
58 }
59 }