You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
684 B
28 lines
684 B
<?php
|
|
|
|
namespace App\Console\Commands\Handlers;
|
|
|
|
use App\Console\Commands\Contracts\AttributeScanHandler;
|
|
|
|
class GenericSeoAttributeHandler implements AttributeScanHandler
|
|
{
|
|
public function __construct(private readonly string $className) {}
|
|
|
|
public function attributeClass(): string
|
|
{
|
|
return $this->className;
|
|
}
|
|
|
|
public function extractTranslationKeys(array $arguments): array
|
|
{
|
|
$keys = [];
|
|
|
|
array_walk_recursive($arguments, function ($val) use (&$keys) {
|
|
if (is_string($val) && (str_contains($val, '/') || str_contains($val, '.'))) {
|
|
$keys[] = $val;
|
|
}
|
|
});
|
|
|
|
return $keys;
|
|
}
|
|
}
|
|
|