Conditions | 1 |
Paths | 1 |
Total Lines | 29 |
Code Lines | 17 |
Lines | 29 |
Ratio | 100 % |
1 | <?php |
||
10 | View Code Duplication | public function __construct($arguments) { |
|
|
|||
11 | parent::__construct($arguments); |
||
12 | $this->description = t('Import nodes.'); |
||
13 | |||
14 | // Create a map object for tracking the relationships between source rows |
||
15 | $this->map = new MigrateSQLMap($this->machineName, |
||
16 | array( |
||
17 | 'tweet_id' => array( |
||
18 | 'type' => 'varchar', |
||
19 | 'length' => 255, |
||
20 | 'not null' => TRUE, |
||
21 | ), |
||
22 | ), |
||
23 | MigrateDestinationNode::getKeySchema() |
||
24 | ); |
||
25 | |||
26 | $import_path = drupal_get_path('module', 'dfs_wem') . '/import/'; |
||
27 | |||
28 | // Create a MigrateSource object. |
||
29 | $this->source = new MigrateSourceCSV($import_path . 'dfs_wem.nodes.wem_tweets.csv', $this->csvcolumns(), array('header_rows' => 1)); |
||
30 | $this->destination = new MigrateDestinationNode('wem_tweet'); |
||
31 | |||
32 | // Tweet Fields |
||
33 | $this->addFieldMapping('title', 'tweet_id'); |
||
34 | $this->addFieldMapping('body', 'tweet'); |
||
35 | $this->addFieldMapping('field_wem_tweet_id', 'tweet_id'); |
||
36 | $this->addFieldMapping('field_wem_tweet_from', 'tweet_from'); |
||
37 | |||
38 | } |
||
39 | |||
50 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.