Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/Icons/src/Command/LockIconsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,21 @@ protected function execute(InputInterface $input, OutputInterface $output): int

[$prefix, $name] = $parts;

if (!$this->iconify->hasIconSet($prefix)) {
// not an icon set? example: "og:twitter"
if ($io->isVeryVerbose()) {
$io->writeln(\sprintf(' <fg=bright-yellow;options=bold>✗</> IconSet Not Found: <fg=bright-white;bg=black>%s:%s</>.', $prefix, $name));
}
continue;
}

try {
$svg = $this->iconify->fetchSvg($prefix, $name);
} catch (IconNotFoundException) {
// icon not found on iconify
if ($io->isVerbose()) {
$io->writeln(\sprintf(' <fg=bright-red;options=bold>✗</> Icon Not Found: <fg=bright-white;bg=black>%s:%s</>.', $prefix, $name));
}
continue;
}

Expand All @@ -84,7 +95,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$license = $this->iconify->metadataFor($prefix)['license'];
++$count;

$io->text(\sprintf(
$io->writeln(\sprintf(
" <fg=bright-green;options=bold>✓</> Imported <fg=bright-white;bg=black>%s:</><fg=bright-magenta;bg=black;options>%s</> (License: <href=%s>%s</>). Render with: <comment>{{ ux_icon('%s') }}</comment>",
$prefix,
$name,
Expand Down
5 changes: 5 additions & 0 deletions src/Icons/src/Iconify.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ public function fetchSvg(string $prefix, string $name): string
return $content;
}

public function hasIconSet(string $prefix): bool
{
return isset($this->sets()[$prefix]);
}

public function getIconSets(): array
{
return $this->sets()->getArrayCopy();
Expand Down