diff --git a/Module.php b/Module.php index 89ae43e..598661b 100644 --- a/Module.php +++ b/Module.php @@ -2,7 +2,6 @@ namespace CSVImport; use Omeka\Module\AbstractModule; -use Omeka\Entity\Job; use Zend\ModuleManager\ModuleManager; use Zend\ServiceManager\ServiceLocatorInterface; diff --git a/src/Form/ImportForm.php b/src/Form/ImportForm.php index 32f30d7..a1d0093 100644 --- a/src/Form/ImportForm.php +++ b/src/Form/ImportForm.php @@ -118,7 +118,6 @@ public function init() ], ]); - $this->add([ 'name' => 'automap_check_names_alone', 'type' => 'checkbox', diff --git a/src/Form/MappingForm.php b/src/Form/MappingForm.php index b1911f5..52fbc78 100644 --- a/src/Form/MappingForm.php +++ b/src/Form/MappingForm.php @@ -53,7 +53,7 @@ public function init() 'type' => 'hidden', 'attributes' => [ 'value' => $this->getOption('comment'), - ] + ], ]); $this->add([ @@ -71,7 +71,7 @@ public function init() 'attributes' => [ 'id' => 'csv-import-basics-fieldset', 'class' => 'section', - ] + ], ]); $basicSettingsFieldset = $this->get('basic-settings'); @@ -271,7 +271,7 @@ public function init() 'attributes' => [ 'id' => 'csv-import-advanced-fieldset', 'class' => 'section', - ] + ], ]); $advancedSettingsFieldset = $this->get('advanced-settings'); @@ -310,12 +310,12 @@ public function init() 'attributes' => [ 'id' => 'identifier_column', 'class' => 'action-option', - ] + ], ]); } else { $advancedSettingsFieldset->add([ 'name' => 'identifier_column', - 'type' => 'Number' + 'type' => 'Number', ]); } @@ -369,7 +369,7 @@ public function init() 'value' => $userSettings->get( 'csv_import_rows_by_batch', $default['csv_import_rows_by_batch']), - 'min' => '1', + 'min' => '1', 'step' => '1', ], ]); diff --git a/src/Job/Import.php b/src/Job/Import.php index b35c62a..a36cecb 100644 --- a/src/Job/Import.php +++ b/src/Job/Import.php @@ -214,7 +214,9 @@ protected function mapRows(array $rows) { $data = []; foreach ($rows as $row) { - if (!array_filter($row, function ($v) { return strlen($v); })) { + if (!array_filter($row, function ($v) { + return strlen($v); + })) { $this->emptyLines++; continue; } @@ -1138,7 +1140,7 @@ protected function stats($action, array $data = [], array $result = []) }, $result); if ($itemIds) { $entityManager = $this->getServiceLocator()->get('Omeka\EntityManager'); - $query = $entityManager ->createQuery( + $query = $entityManager->createQuery( sprintf('SELECT COUNT(media.id) FROM Omeka\Entity\Media media WHERE media.item IN (%s)', implode(',', $itemIds))); $total = $query->getSingleScalarResult(); diff --git a/src/Mapping/AbstractResourceMapping.php b/src/Mapping/AbstractResourceMapping.php index 2160044..2b6127d 100644 --- a/src/Mapping/AbstractResourceMapping.php +++ b/src/Mapping/AbstractResourceMapping.php @@ -56,7 +56,9 @@ public function processRow(array $row) $values = [$values]; } else { $values = explode($multivalueSeparator, $values); - $values = array_map(function ($v) { return trim($v); }, $values); + $values = array_map(function ($v) { + return trim($v); + }, $values); } $values = array_filter($values, 'strlen'); if ($values) { @@ -94,7 +96,8 @@ protected function processGlobalArgs() $data['o:resource_template'] = ['o:id' => (int) $this->args['o:resource_template']['o:id']]; } if (!empty($this->args['o:resource_class']['o:id'])) { - $data['o:resource_class'] = ['o:id' => (int) $this->args['o:resource_class']['o:id']];; + $data['o:resource_class'] = ['o:id' => (int) $this->args['o:resource_class']['o:id']]; + ; } if (!empty($this->args['o:owner']['o:id'])) { $data['o:owner'] = ['o:id' => (int) $this->args['o:owner']['o:id']]; diff --git a/src/Mapping/PropertyMapping.php b/src/Mapping/PropertyMapping.php index d4e97bf..4278a68 100644 --- a/src/Mapping/PropertyMapping.php +++ b/src/Mapping/PropertyMapping.php @@ -70,9 +70,10 @@ public function processRow(array $row) if (empty($multivalueMap[$index])) { $values = [trim($values)]; } else { - $values = explode($multivalueSeparator, $values); - $values = array_map(function ($v) { return trim($v); }, $values); + $values = array_map(function ($v) { + return trim($v); + }, $values); } $values = array_filter($values, 'strlen'); foreach ($values as $value) { diff --git a/src/Source/AbstractSource.php b/src/Source/AbstractSource.php index 5713966..f9a0baa 100644 --- a/src/Source/AbstractSource.php +++ b/src/Source/AbstractSource.php @@ -164,7 +164,9 @@ public function getRows($offset = 0, $limit = -1) protected function cleanRow(array $row) { - return array_map(function ($v) { return trim($v); }, $row); + return array_map(function ($v) { + return trim($v); + }, $row); } public function clean() diff --git a/src/Source/AbstractSpreadsheet.php b/src/Source/AbstractSpreadsheet.php index 1cf4bae..a2b73ca 100644 --- a/src/Source/AbstractSpreadsheet.php +++ b/src/Source/AbstractSpreadsheet.php @@ -1,7 +1,7 @@