Skip to content

Commit

Permalink
Cleaned with php-cs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-KM authored and zerocrates committed Dec 10, 2019
1 parent 93b1fa9 commit 4e96bc9
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 16 deletions.
1 change: 0 additions & 1 deletion Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
namespace CSVImport;

use Omeka\Module\AbstractModule;
use Omeka\Entity\Job;
use Zend\ModuleManager\ModuleManager;
use Zend\ServiceManager\ServiceLocatorInterface;

Expand Down
1 change: 0 additions & 1 deletion src/Form/ImportForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ public function init()
],
]);


$this->add([
'name' => 'automap_check_names_alone',
'type' => 'checkbox',
Expand Down
12 changes: 6 additions & 6 deletions src/Form/MappingForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function init()
'type' => 'hidden',
'attributes' => [
'value' => $this->getOption('comment'),
]
],
]);

$this->add([
Expand All @@ -71,7 +71,7 @@ public function init()
'attributes' => [
'id' => 'csv-import-basics-fieldset',
'class' => 'section',
]
],
]);

$basicSettingsFieldset = $this->get('basic-settings');
Expand Down Expand Up @@ -271,7 +271,7 @@ public function init()
'attributes' => [
'id' => 'csv-import-advanced-fieldset',
'class' => 'section',
]
],
]);

$advancedSettingsFieldset = $this->get('advanced-settings');
Expand Down Expand Up @@ -310,12 +310,12 @@ public function init()
'attributes' => [
'id' => 'identifier_column',
'class' => 'action-option',
]
],
]);
} else {
$advancedSettingsFieldset->add([
'name' => 'identifier_column',
'type' => 'Number'
'type' => 'Number',
]);
}

Expand Down Expand Up @@ -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',
],
]);
Expand Down
6 changes: 4 additions & 2 deletions src/Job/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
Expand Down
7 changes: 5 additions & 2 deletions src/Mapping/AbstractResourceMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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']];
Expand Down
5 changes: 3 additions & 2 deletions src/Mapping/PropertyMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion src/Source/AbstractSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/Source/AbstractSpreadsheet.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace CSVImport\Source;

/**
/*
* Note: Reader isn’t traversable and has no rewind, so some hacks are required.
* Nevertheless, the library is quick and efficient and the module uses it only
* as recommended (as stream ahead).
Expand Down

0 comments on commit 4e96bc9

Please sign in to comment.