Skip to content

Commit

Permalink
Inline helper method parameter value
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Apr 25, 2023
1 parent b2d97d2 commit eb02163
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/publications/src/Commands/MakePublicationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ protected function captureMediaFieldInput(PublicationFieldDefinition $field): ?P

$mediaFiles = Publications::getMediaForType($this->publicationType);
if ($mediaFiles->isEmpty()) {
return $this->handleEmptyMediaFilesCollection($field, 'media file',
return $this->handleEmptyMediaFilesCollection($field,
// TODO Ask to pick from root media directory?
sprintf('No media files found in directory %s/%s/', Hyde::getMediaDirectory(),
$this->publicationType->getIdentifier()
Expand All @@ -163,7 +163,7 @@ protected function captureMediaFieldInput(PublicationFieldDefinition $field): ?P
}

/** @return null */
protected function handleEmptyMediaFilesCollection(PublicationFieldDefinition $field, string $type, string $message)
protected function handleEmptyMediaFilesCollection(PublicationFieldDefinition $field, string $message)
{
if (in_array('required', $field->rules)) {
throw new InvalidArgumentException("Unable to create publication: $message");
Expand All @@ -174,7 +174,7 @@ protected function handleEmptyMediaFilesCollection(PublicationFieldDefinition $f
if ($this->confirm('Would you like to skip this field?', true)) {
return null;
} else {
throw new InvalidArgumentException("Unable to locate any {$type}s for this publication type");
throw new InvalidArgumentException('Unable to locate any media files for this publication type');
}
}

Expand Down

0 comments on commit eb02163

Please sign in to comment.