Skip to content

Commit

Permalink
CS changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bobdenotter committed Apr 4, 2022
1 parent 771edbd commit 04f0d30
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private function importContentType(string $contenttypeslug, array $data): void
/** @var ContentType $contentType */
$contentType = $this->config->getContentType($record->get('contentType', $contenttypeslug));

if (!$contentType) {
if (! $contentType) {
$this->io->error('Requested ContentType ' . $record->get('contentType', $contenttypeslug) . ' is not defined in contenttypes.yaml.');

return;
Expand Down Expand Up @@ -142,7 +142,7 @@ private function importRecord(ContentType $contentType, Collection $record): voi
/** @var Content $content */
$content = $this->contentRepository->findOneBySlug(Str::slug($slug), $contentType);

if (!$content) {
if (! $content) {
$content = new Content($contentType);
$content->setAuthor($user);
}
Expand All @@ -156,10 +156,10 @@ private function importRecord(ContentType $contentType, Collection $record): voi
// Convert 'file' in incoming image or file to 'filename'
if (in_array($fieldDefinition['type'], ['image', 'file'], true)) {
$item = (array) $item;
$item['filename'] = !empty($item['file']) ? $item['file'] : current($item);
$item['filename'] = ! empty($item['file']) ? $item['file'] : current($item);

// If no filename is set, don't import a broken/missing image
if (!$item['filename']) {
if (! $item['filename']) {
continue;
}
}
Expand Down Expand Up @@ -298,11 +298,11 @@ private function importRecord(ContentType $contentType, Collection $record): voi
foreach ($item as $taxo) {
$configForTaxonomy = $this->config->getTaxonomy($key);

if (!$taxo['slug']) {
if (! $taxo['slug']) {
continue;
}

if (!is_object($configForTaxonomy)) {
if (! is_object($configForTaxonomy)) {
continue;
}

Expand Down Expand Up @@ -420,16 +420,16 @@ private function isLocalisedField(Content $content, string $key, $item): bool
{
$fieldDefinition = $content->getDefinition()->get('fields')->get($key);

if (!$fieldDefinition['localize']) {
if (! $fieldDefinition['localize']) {
return false;
}

if (!is_array($item)) {
if (! is_array($item)) {
return false;
}

foreach (array_keys($item) as $key) {
if (!preg_match('/^[a-z]{2}([_-][a-z]{2,3})?$/i', $key)) {
if (! preg_match('/^[a-z]{2}([_-][a-z]{2,3})?$/i', $key)) {
return false;
}
}
Expand Down Expand Up @@ -486,7 +486,7 @@ private function guesstimateUser(Collection $record): User
}

// Fall back to the first user we can find. 🤷‍
if (!$user) {
if (! $user) {
$user = $this->userRepository->findOneBy([]);
}

Expand Down

0 comments on commit 04f0d30

Please sign in to comment.