Test Failed
Push — master ( 357bf5...71cdad )
by Russell
03:53
created

TransformResult   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
eloc 4
c 1
b 0
f 1
dl 0
loc 17
rs 10
1
<?php
2
3
/**
4
 * Interface defining a transformer from an external content item
5
 * to an internal silverstripe page
6
 *
7
 * @author Marcus Nyeholt <[email protected]>
8
 * @license BSD License http://silverstripe.org/bsd-license
9
 *
10
 */
11
interface ExternalContentTransformer
12
{
13
    public const DS_OVERWRITE = 'Overwrite';
14
    public const DS_DUPLICATE = 'Duplicate';
15
    public const DS_SKIP = 'Skip';
16
17
    /**
18
     * Transforms a given item, creating a new object underneath
19
     * the parent object.
20
     * @param $item
21
     * 			The object to transform
22
     * @param $parentObject
23
     * 			The object to create any new pages underneath
24
     * @param $duplicateStrategy
25
     * 			How to handle duplicates when importing
26
     *
27
     * @return TransformResult
28
     * 			The new page
29
     */
30
    public function transform($item, $parentObject, $duplicateStrategy);
31
}
32
33
/**
34
 * Class to encapsulate the result of a transformation
35
 *
36
 * Contains
37
 *
38
 * page - The created page
39
 * children - A DataObjectSet containing those children
40
 * 			  that can still be used for additional tranforms
41
 * 			  This allows some chidlren to be filtered out (eg dependant pages)
42
 * 			  and loaded by the new page type instead
43
 *
44
 * @author Marcus Nyeholt <[email protected]>
45
 *
46
 */
47
class TransformResult
48
{
49
    public function __construct($page, $children)
50
    {
51
        $this->page = $page;
52
        $this->children = $children;
53
    }
54
55
    /**
56
     * @var SiteTree
57
     */
58
    public $page;
59
60
    /**
61
     * @var DataObjectSet
62
     */
63
    public $children;
64
}
65