Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* @file
* Defines the base class for destination handlers.
*/
/**
* Abstract base class for destination handlers. Handler objects are expected
* to implement appropriate methods (e.g., prepare, complete, or fields).
*/
abstract class MigrateHandler {
/**
* List of other handler classes which should be invoked before the current one.
*
* @var array
*/
protected $dependencies = array();
public function getDependencies() {
return $this->dependencies;
}
/**
* List of "types" handled by this handler. Depending on the kind of handler,
* these may be destination types, field types, etc.
*
* @var array
*/
protected $typesHandled = array();
/**
* Register a list of types handled by this class
*
* @param array $types
*/
protected function registerTypes(array $types) {
// Make the type names the keys
foreach ($types as $type) {
$type = strtolower($type);
$this->typesHandled[$type] = $type;
}
}
/**
* Does this handler handle the given type?
*
* @param boolean $type
*/
public function handlesType($type) {
return isset($this->typesHandled[strtolower($type)]);
}
abstract public function __construct();
}