Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 13 |
EmptySource | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 13 |
fields | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
initializeIterator | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
__toString | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
getIds | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
count | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
<?php | |
/** | |
* @file | |
* Contains \Drupal\migrate\Plugin\migrate\source\EmptySource. | |
*/ | |
namespace Drupal\migrate\Plugin\migrate\source; | |
/** | |
* Source returning an empty row. | |
* | |
* This is generally useful when needing to create a field using a migration.. | |
* | |
* @MigrateSource( | |
* id = "empty" | |
* ) | |
*/ | |
class EmptySource extends SourcePluginBase { | |
/** | |
* {@inheritdoc} | |
*/ | |
public function fields() { | |
return array( | |
'id' => t('ID'), | |
); | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function initializeIterator() { | |
return new \ArrayIterator(array(array('id' => ''))); | |
} | |
/** | |
* Allows class to decide how it will react when it is treated like a string. | |
*/ | |
public function __toString() { | |
return ''; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function getIds() { | |
$ids['id']['type'] = 'string'; | |
return $ids; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function count() { | |
return 1; | |
} | |
} |