latest update
This commit is contained in:
parent
7a7ed16830
commit
026a23ade1
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('guest_notes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('guest_id')->constrained()->onDelete('cascade');
|
||||
$table->text('note_text');
|
||||
$table->foreignId('staff_id')->constrained('users')->onDelete('cascade');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('guest_notes');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('vouchers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('code')->unique();
|
||||
$table->string('name');
|
||||
$table->text('description')->nullable();
|
||||
$table->decimal('discount_amount', 10, 2)->nullable();
|
||||
$table->integer('discount_percentage')->nullable();
|
||||
$table->date('valid_from');
|
||||
$table->date('valid_until');
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('vouchers');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('loyalty_tiers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->integer('min_visits');
|
||||
$table->integer('min_spend');
|
||||
$table->decimal('discount_percentage', 5, 2);
|
||||
$table->text('benefits')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('loyalty_tiers');
|
||||
}
|
||||
};
|
||||
@ -13,6 +13,11 @@ return new class extends Migration
|
||||
{
|
||||
Schema::create('campaigns', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->json('segment_rules');
|
||||
$table->text('offer_text');
|
||||
$table->foreignId('voucher_id')->constrained()->onDelete('cascade');
|
||||
$table->enum('status', ['active', 'inactive', 'draft'])->default('draft');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
90
vendor/_laravel_ide/discover-31b934f114eabc246b541addb8b458e3.php
vendored
Normal file
90
vendor/_laravel_ide/discover-31b934f114eabc246b541addb8b458e3.php
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
require_once __DIR__ . '/../autoload.php';
|
||||
|
||||
class LaravelVsCode
|
||||
{
|
||||
public static function relativePath($path)
|
||||
{
|
||||
if (!str_contains($path, base_path())) {
|
||||
return (string) $path;
|
||||
}
|
||||
|
||||
return ltrim(str_replace(base_path(), '', realpath($path) ?: $path), DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
public static function isVendor($path)
|
||||
{
|
||||
return str_contains($path, base_path("vendor"));
|
||||
}
|
||||
|
||||
public static function outputMarker($key)
|
||||
{
|
||||
return '__VSCODE_LARAVEL_' . $key . '__';
|
||||
}
|
||||
|
||||
public static function startupError(\Throwable $e)
|
||||
{
|
||||
throw new Error(self::outputMarker('STARTUP_ERROR') . ': ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$app = require_once __DIR__ . '/../../bootstrap/app.php';
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$app->register(new class($app) extends \Illuminate\Support\ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
config([
|
||||
'logging.channels.null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => \Monolog\Handler\NullHandler::class,
|
||||
],
|
||||
'logging.default' => 'null',
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
$kernel->bootstrap();
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo LaravelVsCode::outputMarker('START_OUTPUT');
|
||||
|
||||
echo collect(app()->getBindings())
|
||||
->filter(fn ($binding) => ($binding['concrete'] ?? null) !== null)
|
||||
->flatMap(function ($binding, $key) {
|
||||
$boundTo = new ReflectionFunction($binding['concrete']);
|
||||
|
||||
$closureClass = $boundTo->getClosureScopeClass();
|
||||
|
||||
if ($closureClass === null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
$key => [
|
||||
'path' => LaravelVsCode::relativePath($closureClass->getFileName()),
|
||||
'class' => $closureClass->getName(),
|
||||
'line' => $boundTo->getStartLine(),
|
||||
],
|
||||
];
|
||||
})->toJson();
|
||||
|
||||
echo LaravelVsCode::outputMarker('END_OUTPUT');
|
||||
|
||||
exit(0);
|
||||
75
vendor/_laravel_ide/discover-476fe65492650d7ce55de1f8f96024c5.php
vendored
Normal file
75
vendor/_laravel_ide/discover-476fe65492650d7ce55de1f8f96024c5.php
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
require_once __DIR__ . '/../autoload.php';
|
||||
|
||||
class LaravelVsCode
|
||||
{
|
||||
public static function relativePath($path)
|
||||
{
|
||||
if (!str_contains($path, base_path())) {
|
||||
return (string) $path;
|
||||
}
|
||||
|
||||
return ltrim(str_replace(base_path(), '', realpath($path) ?: $path), DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
public static function isVendor($path)
|
||||
{
|
||||
return str_contains($path, base_path("vendor"));
|
||||
}
|
||||
|
||||
public static function outputMarker($key)
|
||||
{
|
||||
return '__VSCODE_LARAVEL_' . $key . '__';
|
||||
}
|
||||
|
||||
public static function startupError(\Throwable $e)
|
||||
{
|
||||
throw new Error(self::outputMarker('STARTUP_ERROR') . ': ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$app = require_once __DIR__ . '/../../bootstrap/app.php';
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$app->register(new class($app) extends \Illuminate\Support\ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
config([
|
||||
'logging.channels.null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => \Monolog\Handler\NullHandler::class,
|
||||
],
|
||||
'logging.default' => 'null',
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
$kernel->bootstrap();
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo LaravelVsCode::outputMarker('START_OUTPUT');
|
||||
|
||||
echo json_encode([
|
||||
'php_version' => phpversion(),
|
||||
'laravel_version' => app()->version(),
|
||||
]);
|
||||
|
||||
echo LaravelVsCode::outputMarker('END_OUTPUT');
|
||||
|
||||
exit(0);
|
||||
105
vendor/_laravel_ide/discover-5802e590a92e23606bb54d2909564178.php
vendored
Normal file
105
vendor/_laravel_ide/discover-5802e590a92e23606bb54d2909564178.php
vendored
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
require_once __DIR__ . '/../autoload.php';
|
||||
|
||||
class LaravelVsCode
|
||||
{
|
||||
public static function relativePath($path)
|
||||
{
|
||||
if (!str_contains($path, base_path())) {
|
||||
return (string) $path;
|
||||
}
|
||||
|
||||
return ltrim(str_replace(base_path(), '', realpath($path) ?: $path), DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
public static function isVendor($path)
|
||||
{
|
||||
return str_contains($path, base_path("vendor"));
|
||||
}
|
||||
|
||||
public static function outputMarker($key)
|
||||
{
|
||||
return '__VSCODE_LARAVEL_' . $key . '__';
|
||||
}
|
||||
|
||||
public static function startupError(\Throwable $e)
|
||||
{
|
||||
throw new Error(self::outputMarker('STARTUP_ERROR') . ': ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$app = require_once __DIR__ . '/../../bootstrap/app.php';
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$app->register(new class($app) extends \Illuminate\Support\ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
config([
|
||||
'logging.channels.null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => \Monolog\Handler\NullHandler::class,
|
||||
],
|
||||
'logging.default' => 'null',
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
$kernel->bootstrap();
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo LaravelVsCode::outputMarker('START_OUTPUT');
|
||||
|
||||
echo json_encode([
|
||||
[
|
||||
'key' => 'base_path',
|
||||
'path' => base_path(),
|
||||
],
|
||||
[
|
||||
'key' => 'resource_path',
|
||||
'path' => resource_path(),
|
||||
],
|
||||
[
|
||||
'key' => 'config_path',
|
||||
'path' => config_path(),
|
||||
],
|
||||
[
|
||||
'key' => 'app_path',
|
||||
'path' => app_path(),
|
||||
],
|
||||
[
|
||||
'key' => 'database_path',
|
||||
'path' => database_path(),
|
||||
],
|
||||
[
|
||||
'key' => 'lang_path',
|
||||
'path' => lang_path(),
|
||||
],
|
||||
[
|
||||
'key' => 'public_path',
|
||||
'path' => public_path(),
|
||||
],
|
||||
[
|
||||
'key' => 'storage_path',
|
||||
'path' => storage_path(),
|
||||
],
|
||||
]);
|
||||
|
||||
echo LaravelVsCode::outputMarker('END_OUTPUT');
|
||||
|
||||
exit(0);
|
||||
355
vendor/_laravel_ide/discover-5b6a8384942db1c03ab2ddca280c9dbf.php
vendored
Normal file
355
vendor/_laravel_ide/discover-5b6a8384942db1c03ab2ddca280c9dbf.php
vendored
Normal file
@ -0,0 +1,355 @@
|
||||
<?php
|
||||
|
||||
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
require_once __DIR__ . '/../autoload.php';
|
||||
|
||||
class LaravelVsCode
|
||||
{
|
||||
public static function relativePath($path)
|
||||
{
|
||||
if (!str_contains($path, base_path())) {
|
||||
return (string) $path;
|
||||
}
|
||||
|
||||
return ltrim(str_replace(base_path(), '', realpath($path) ?: $path), DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
public static function isVendor($path)
|
||||
{
|
||||
return str_contains($path, base_path("vendor"));
|
||||
}
|
||||
|
||||
public static function outputMarker($key)
|
||||
{
|
||||
return '__VSCODE_LARAVEL_' . $key . '__';
|
||||
}
|
||||
|
||||
public static function startupError(\Throwable $e)
|
||||
{
|
||||
throw new Error(self::outputMarker('STARTUP_ERROR') . ': ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$app = require_once __DIR__ . '/../../bootstrap/app.php';
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$app->register(new class($app) extends \Illuminate\Support\ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
config([
|
||||
'logging.channels.null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => \Monolog\Handler\NullHandler::class,
|
||||
],
|
||||
'logging.default' => 'null',
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
$kernel->bootstrap();
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo LaravelVsCode::outputMarker('START_OUTPUT');
|
||||
|
||||
if (class_exists('\phpDocumentor\Reflection\DocBlockFactory')) {
|
||||
$factory = \phpDocumentor\Reflection\DocBlockFactory::createInstance();
|
||||
} else {
|
||||
$factory = null;
|
||||
}
|
||||
|
||||
$docblocks = new class($factory) {
|
||||
public function __construct(protected $factory) {}
|
||||
|
||||
public function forMethod($method)
|
||||
{
|
||||
if ($this->factory !== null) {
|
||||
$docblock = $this->factory->create($method->getDocComment());
|
||||
$params = collect($docblock->getTagsByName("param"))->map(fn($p) => (string) $p)->all();
|
||||
$return = (string) $docblock->getTagsByName("return")[0] ?? null;
|
||||
|
||||
return [$params, $return];
|
||||
}
|
||||
|
||||
|
||||
$params = collect($method->getParameters())
|
||||
->map(function (\ReflectionParameter $param) {
|
||||
$types = match ($param?->getType()) {
|
||||
null => [],
|
||||
default => method_exists($param->getType(), "getTypes")
|
||||
? $param->getType()->getTypes()
|
||||
: [$param->getType()]
|
||||
};
|
||||
|
||||
$types = collect($types)
|
||||
->filter()
|
||||
->values()
|
||||
->map(fn($t) => $t->getName());
|
||||
|
||||
return trim($types->join("|") . " $" . $param->getName());
|
||||
})
|
||||
->all();
|
||||
|
||||
$return = $method->getReturnType()?->getName();
|
||||
|
||||
return [$params, $return];
|
||||
}
|
||||
};
|
||||
|
||||
$models = new class($factory) {
|
||||
protected $output;
|
||||
|
||||
public function __construct(protected $factory)
|
||||
{
|
||||
$this->output = new \Symfony\Component\Console\Output\BufferedOutput();
|
||||
}
|
||||
|
||||
public function all()
|
||||
{
|
||||
if (\Illuminate\Support\Facades\File::isDirectory(base_path('app/Models'))) {
|
||||
collect(\Illuminate\Support\Facades\File::allFiles(base_path('app/Models')))
|
||||
->filter(fn(\Symfony\Component\Finder\SplFileInfo $file) => $file->getExtension() === 'php')
|
||||
->each(fn($file) => include_once($file));
|
||||
}
|
||||
|
||||
return collect(get_declared_classes())
|
||||
->filter(fn($class) => is_subclass_of($class, \Illuminate\Database\Eloquent\Model::class))
|
||||
->filter(fn($class) => !in_array($class, [\Illuminate\Database\Eloquent\Relations\Pivot::class, \Illuminate\Foundation\Auth\User::class]))
|
||||
->values()
|
||||
->flatMap(fn(string $className) => $this->getInfo($className))
|
||||
->filter();
|
||||
}
|
||||
|
||||
protected function getCastReturnType($className)
|
||||
{
|
||||
if ($className === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
$method = (new \ReflectionClass($className))->getMethod('get');
|
||||
|
||||
if ($method->hasReturnType()) {
|
||||
return $method->getReturnType()->getName();
|
||||
}
|
||||
|
||||
return $className;
|
||||
} catch (\Exception | \Throwable $e) {
|
||||
return $className;
|
||||
}
|
||||
}
|
||||
|
||||
protected function fromArtisan($className)
|
||||
{
|
||||
try {
|
||||
\Illuminate\Support\Facades\Artisan::call(
|
||||
"model:show",
|
||||
[
|
||||
"model" => $className,
|
||||
"--json" => true,
|
||||
],
|
||||
$this->output
|
||||
);
|
||||
} catch (\Exception | \Throwable $e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return json_decode($this->output->fetch(), true);
|
||||
}
|
||||
|
||||
protected function collectExistingProperties($reflection)
|
||||
{
|
||||
if ($this->factory === null) {
|
||||
return collect();
|
||||
}
|
||||
|
||||
if ($comment = $reflection->getDocComment()) {
|
||||
$docblock = $this->factory->create($comment);
|
||||
|
||||
$existingProperties = collect($docblock->getTagsByName("property"))->map(fn($p) => $p->getVariableName());
|
||||
$existingReadProperties = collect($docblock->getTagsByName("property-read"))->map(fn($p) => $p->getVariableName());
|
||||
|
||||
return $existingProperties->merge($existingReadProperties);
|
||||
}
|
||||
|
||||
return collect();
|
||||
}
|
||||
|
||||
protected function getParentClass(\ReflectionClass $reflection)
|
||||
{
|
||||
if (!$reflection->getParentClass()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$parent = $reflection->getParentClass()->getName();
|
||||
|
||||
if ($parent === \Illuminate\Database\Eloquent\Model::class) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return \Illuminate\Support\Str::start($parent, '\\');
|
||||
}
|
||||
|
||||
protected function getInfo($className)
|
||||
{
|
||||
if (($data = $this->fromArtisan($className)) === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$reflection = new \ReflectionClass($className);
|
||||
|
||||
$data["extends"] = $this->getParentClass($reflection);
|
||||
|
||||
$existingProperties = $this->collectExistingProperties($reflection);
|
||||
|
||||
$data['attributes'] = collect($data['attributes'])
|
||||
->map(fn($attrs) => array_merge($attrs, [
|
||||
'title_case' => str($attrs['name'])->title()->replace('_', '')->toString(),
|
||||
'documented' => $existingProperties->contains($attrs['name']),
|
||||
'cast' => $this->getCastReturnType($attrs['cast'])
|
||||
]))
|
||||
->toArray();
|
||||
|
||||
$data['scopes'] = collect($reflection->getMethods())
|
||||
->filter(fn(\ReflectionMethod $method) => !$method->isStatic() && ($method->getAttributes(\Illuminate\Database\Eloquent\Attributes\Scope::class) || ($method->isPublic() && str_starts_with($method->name, 'scope'))))
|
||||
->map(fn(\ReflectionMethod $method) => [
|
||||
"name" => str($method->name)->replace('scope', '')->lcfirst()->toString(),
|
||||
"method" => $method->name,
|
||||
"parameters" => collect($method->getParameters())->map($this->getScopeParameterInfo(...)),
|
||||
])
|
||||
->values()
|
||||
->toArray();
|
||||
|
||||
$data['uri'] = $reflection->getFileName();
|
||||
|
||||
return [
|
||||
$className => $data,
|
||||
];
|
||||
}
|
||||
|
||||
protected function getScopeParameterInfo(\ReflectionParameter $parameter): array
|
||||
{
|
||||
$result = [
|
||||
"name" => $parameter->getName(),
|
||||
"type" => $this->typeToString($parameter->getType()),
|
||||
"hasDefault" => $parameter->isDefaultValueAvailable(),
|
||||
"isVariadic" => $parameter->isVariadic(),
|
||||
"isPassedByReference" => $parameter->isPassedByReference(),
|
||||
];
|
||||
|
||||
if ($parameter->isDefaultValueAvailable()) {
|
||||
$result['default'] = $this->defaultValueToString($parameter);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function typeToString(?\ReflectionType $type): string
|
||||
{
|
||||
return match (true) {
|
||||
$type instanceof \ReflectionNamedType => $this->namedTypeToString($type),
|
||||
$type instanceof \ReflectionUnionType => $this->unionTypeToString($type),
|
||||
$type instanceof \ReflectionIntersectionType => $this->intersectionTypeToString($type),
|
||||
default => 'mixed',
|
||||
};
|
||||
}
|
||||
|
||||
protected function namedTypeToString(\ReflectionNamedType $type): string
|
||||
{
|
||||
$name = $type->getName();
|
||||
|
||||
if (! $type->isBuiltin() && ! in_array($name, ['self', 'parent', 'static'])) {
|
||||
$name = '\\'.$name;
|
||||
}
|
||||
|
||||
if ($type->allowsNull() && ! in_array($name, ['null', 'mixed', 'void'])) {
|
||||
$name = '?'.$name;
|
||||
}
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
||||
protected function unionTypeToString(\ReflectionUnionType $type): string
|
||||
{
|
||||
return implode('|', array_map(function (\ReflectionType $type) {
|
||||
$result = $this->typeToString($type);
|
||||
|
||||
if ($type instanceof \ReflectionIntersectionType) {
|
||||
return "({$result})";
|
||||
}
|
||||
|
||||
return $result;
|
||||
}, $type->getTypes()));
|
||||
}
|
||||
|
||||
protected function intersectionTypeToString(\ReflectionIntersectionType $type): string
|
||||
{
|
||||
return implode('&', array_map($this->typeToString(...), $type->getTypes()));
|
||||
}
|
||||
|
||||
protected function defaultValueToString(\ReflectionParameter $param): string
|
||||
{
|
||||
if ($param->isDefaultValueConstant()) {
|
||||
return '\\'.$param->getDefaultValueConstantName();
|
||||
}
|
||||
|
||||
$value = $param->getDefaultValue();
|
||||
|
||||
return match (true) {
|
||||
is_null($value) => 'null',
|
||||
is_numeric($value) => $value,
|
||||
is_bool($value) => $value ? 'true' : 'false',
|
||||
is_array($value) => '[]',
|
||||
is_object($value) => 'new \\'.get_class($value),
|
||||
default => "'{$value}'",
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
$builder = new class($docblocks) {
|
||||
public function __construct(protected $docblocks) {}
|
||||
|
||||
public function methods()
|
||||
{
|
||||
$reflection = new \ReflectionClass(\Illuminate\Database\Query\Builder::class);
|
||||
|
||||
return collect($reflection->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED))
|
||||
->filter(fn(ReflectionMethod $method) => !str_starts_with($method->getName(), "__") || (!$method->isPublic() && empty($method->getAttributes(\Illuminate\Database\Eloquent\Attributes\Scope::class))))
|
||||
->map(fn(\ReflectionMethod $method) => $this->getMethodInfo($method))
|
||||
->filter()
|
||||
->values();
|
||||
}
|
||||
|
||||
protected function getMethodInfo($method)
|
||||
{
|
||||
[$params, $return] = $this->docblocks->forMethod($method);
|
||||
|
||||
return [
|
||||
"name" => $method->getName(),
|
||||
"parameters" => $params,
|
||||
"return" => $return,
|
||||
];
|
||||
}
|
||||
};
|
||||
|
||||
echo json_encode([
|
||||
'builderMethods' => $builder->methods(),
|
||||
'models' => $models->all(),
|
||||
]);
|
||||
|
||||
echo LaravelVsCode::outputMarker('END_OUTPUT');
|
||||
|
||||
exit(0);
|
||||
220
vendor/_laravel_ide/discover-6d96201ad95cad12367117063c707ebf.php
vendored
Normal file
220
vendor/_laravel_ide/discover-6d96201ad95cad12367117063c707ebf.php
vendored
Normal file
@ -0,0 +1,220 @@
|
||||
<?php
|
||||
|
||||
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
require_once __DIR__ . '/../autoload.php';
|
||||
|
||||
class LaravelVsCode
|
||||
{
|
||||
public static function relativePath($path)
|
||||
{
|
||||
if (!str_contains($path, base_path())) {
|
||||
return (string) $path;
|
||||
}
|
||||
|
||||
return ltrim(str_replace(base_path(), '', realpath($path) ?: $path), DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
public static function isVendor($path)
|
||||
{
|
||||
return str_contains($path, base_path("vendor"));
|
||||
}
|
||||
|
||||
public static function outputMarker($key)
|
||||
{
|
||||
return '__VSCODE_LARAVEL_' . $key . '__';
|
||||
}
|
||||
|
||||
public static function startupError(\Throwable $e)
|
||||
{
|
||||
throw new Error(self::outputMarker('STARTUP_ERROR') . ': ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$app = require_once __DIR__ . '/../../bootstrap/app.php';
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$app->register(new class($app) extends \Illuminate\Support\ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
config([
|
||||
'logging.channels.null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => \Monolog\Handler\NullHandler::class,
|
||||
],
|
||||
'logging.default' => 'null',
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
$kernel->bootstrap();
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo LaravelVsCode::outputMarker('START_OUTPUT');
|
||||
|
||||
$local = collect(\Illuminate\Support\Facades\File::allFiles(config_path()))
|
||||
->filter(fn(\Symfony\Component\Finder\SplFileInfo $file) => $file->getExtension() === 'php')
|
||||
->map(fn (\Symfony\Component\Finder\SplFileInfo $file) => $file->getPathname())
|
||||
->map(fn ($path) => [
|
||||
(string) str($path)
|
||||
->replace([config_path(DIRECTORY_SEPARATOR), ".php"], "")
|
||||
->replace(DIRECTORY_SEPARATOR, "."),
|
||||
$path
|
||||
]);
|
||||
|
||||
$vendor = collect(glob(base_path("vendor/**/**/config/*.php")))->map(fn (
|
||||
$path
|
||||
) => [
|
||||
(string) str($path)
|
||||
->afterLast(DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR)
|
||||
->replace(".php", "")
|
||||
->replace(DIRECTORY_SEPARATOR, "."),
|
||||
$path
|
||||
]);
|
||||
|
||||
$configPaths = $local
|
||||
->merge($vendor)
|
||||
->groupBy(0)
|
||||
->map(fn ($items)=>$items->pluck(1));
|
||||
|
||||
$cachedContents = [];
|
||||
$cachedParsed = [];
|
||||
|
||||
function vsCodeGetConfigValue($value, $key, $configPaths) {
|
||||
$parts = explode(".", $key);
|
||||
$toFind = $key;
|
||||
$found = null;
|
||||
|
||||
while (count($parts) > 0) {
|
||||
$toFind = implode(".", $parts);
|
||||
|
||||
if ($configPaths->has($toFind)) {
|
||||
$found = $toFind;
|
||||
break;
|
||||
}
|
||||
|
||||
array_pop($parts);
|
||||
}
|
||||
|
||||
if ($found === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$file = null;
|
||||
$line = null;
|
||||
|
||||
if ($found === $key) {
|
||||
$file = $configPaths->get($found)[0];
|
||||
} else {
|
||||
foreach ($configPaths->get($found) as $path) {
|
||||
$cachedContents[$path] ??= file_get_contents($path);
|
||||
$cachedParsed[$path] ??= token_get_all($cachedContents[$path]);
|
||||
|
||||
$keysToFind = str($key)
|
||||
->replaceFirst($found, "")
|
||||
->ltrim(".")
|
||||
->explode(".");
|
||||
|
||||
if (is_numeric($keysToFind->last())) {
|
||||
$index = $keysToFind->pop();
|
||||
|
||||
if ($index !== "0") {
|
||||
return null;
|
||||
}
|
||||
|
||||
$key = collect(explode(".", $key));
|
||||
$key->pop();
|
||||
$key = $key->implode(".");
|
||||
$value = "array(...)";
|
||||
}
|
||||
|
||||
$nextKey = $keysToFind->shift();
|
||||
$expectedDepth = 1;
|
||||
|
||||
$depth = 0;
|
||||
|
||||
foreach ($cachedParsed[$path] as $token) {
|
||||
if ($token === "[") {
|
||||
$depth++;
|
||||
}
|
||||
|
||||
if ($token === "]") {
|
||||
$depth--;
|
||||
}
|
||||
|
||||
if (!is_array($token)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$str = trim($token[1], '"\'');
|
||||
|
||||
if (
|
||||
$str === $nextKey &&
|
||||
$depth === $expectedDepth &&
|
||||
$token[0] === T_CONSTANT_ENCAPSED_STRING
|
||||
) {
|
||||
$nextKey = $keysToFind->shift();
|
||||
$expectedDepth++;
|
||||
|
||||
if ($nextKey === null) {
|
||||
$file = $path;
|
||||
$line = $token[2];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($file) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_object($value)) {
|
||||
$value = get_class($value);
|
||||
}
|
||||
|
||||
return [
|
||||
"name" => $key,
|
||||
"value" => $value,
|
||||
"file" => $file === null ? null : str_replace(base_path(DIRECTORY_SEPARATOR), '', $file),
|
||||
"line" => $line
|
||||
];
|
||||
}
|
||||
|
||||
function vsCodeUnpackDottedKey($value, $key) {
|
||||
$arr = [$key => $value];
|
||||
$parts = explode('.', $key);
|
||||
array_pop($parts);
|
||||
|
||||
while (count($parts)) {
|
||||
$arr[implode('.', $parts)] = 'array(...)';
|
||||
array_pop($parts);
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
echo collect(\Illuminate\Support\Arr::dot(config()->all()))
|
||||
->mapWithKeys(fn($value, $key) => vsCodeUnpackDottedKey($value, $key))
|
||||
->map(fn ($value, $key) => vsCodeGetConfigValue($value, $key, $configPaths))
|
||||
->filter()
|
||||
->values()
|
||||
->toJson();
|
||||
|
||||
echo LaravelVsCode::outputMarker('END_OUTPUT');
|
||||
|
||||
exit(0);
|
||||
92
vendor/_laravel_ide/discover-7563160ca998bde672640aa1e68dfd08.php
vendored
Normal file
92
vendor/_laravel_ide/discover-7563160ca998bde672640aa1e68dfd08.php
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
require_once __DIR__ . '/../autoload.php';
|
||||
|
||||
class LaravelVsCode
|
||||
{
|
||||
public static function relativePath($path)
|
||||
{
|
||||
if (!str_contains($path, base_path())) {
|
||||
return (string) $path;
|
||||
}
|
||||
|
||||
return ltrim(str_replace(base_path(), '', realpath($path) ?: $path), DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
public static function isVendor($path)
|
||||
{
|
||||
return str_contains($path, base_path("vendor"));
|
||||
}
|
||||
|
||||
public static function outputMarker($key)
|
||||
{
|
||||
return '__VSCODE_LARAVEL_' . $key . '__';
|
||||
}
|
||||
|
||||
public static function startupError(\Throwable $e)
|
||||
{
|
||||
throw new Error(self::outputMarker('STARTUP_ERROR') . ': ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$app = require_once __DIR__ . '/../../bootstrap/app.php';
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$app->register(new class($app) extends \Illuminate\Support\ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
config([
|
||||
'logging.channels.null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => \Monolog\Handler\NullHandler::class,
|
||||
],
|
||||
'logging.default' => 'null',
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
$kernel->bootstrap();
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo LaravelVsCode::outputMarker('START_OUTPUT');
|
||||
|
||||
echo collect(app(\Illuminate\View\Compilers\BladeCompiler::class)->getCustomDirectives())
|
||||
->map(function ($customDirective, $name) {
|
||||
if ($customDirective instanceof \Closure) {
|
||||
return [
|
||||
'name' => $name,
|
||||
'hasParams' => (new ReflectionFunction($customDirective))->getNumberOfParameters() >= 1,
|
||||
];
|
||||
}
|
||||
|
||||
if (is_array($customDirective)) {
|
||||
return [
|
||||
'name' => $name,
|
||||
'hasParams' => (new ReflectionMethod($customDirective[0], $customDirective[1]))->getNumberOfParameters() >= 1,
|
||||
];
|
||||
}
|
||||
|
||||
return null;
|
||||
})
|
||||
->filter()
|
||||
->values()
|
||||
->toJson();
|
||||
|
||||
echo LaravelVsCode::outputMarker('END_OUTPUT');
|
||||
|
||||
exit(0);
|
||||
165
vendor/_laravel_ide/discover-af6a300c8cbdb761fde4dbad46137744.php
vendored
Normal file
165
vendor/_laravel_ide/discover-af6a300c8cbdb761fde4dbad46137744.php
vendored
Normal file
@ -0,0 +1,165 @@
|
||||
<?php
|
||||
|
||||
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
require_once __DIR__ . '/../autoload.php';
|
||||
|
||||
class LaravelVsCode
|
||||
{
|
||||
public static function relativePath($path)
|
||||
{
|
||||
if (!str_contains($path, base_path())) {
|
||||
return (string) $path;
|
||||
}
|
||||
|
||||
return ltrim(str_replace(base_path(), '', realpath($path) ?: $path), DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
public static function isVendor($path)
|
||||
{
|
||||
return str_contains($path, base_path("vendor"));
|
||||
}
|
||||
|
||||
public static function outputMarker($key)
|
||||
{
|
||||
return '__VSCODE_LARAVEL_' . $key . '__';
|
||||
}
|
||||
|
||||
public static function startupError(\Throwable $e)
|
||||
{
|
||||
throw new Error(self::outputMarker('STARTUP_ERROR') . ': ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$app = require_once __DIR__ . '/../../bootstrap/app.php';
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$app->register(new class($app) extends \Illuminate\Support\ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
config([
|
||||
'logging.channels.null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => \Monolog\Handler\NullHandler::class,
|
||||
],
|
||||
'logging.default' => 'null',
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
$kernel->bootstrap();
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo LaravelVsCode::outputMarker('START_OUTPUT');
|
||||
|
||||
$routes = new class {
|
||||
public function all()
|
||||
{
|
||||
return collect(app('router')->getRoutes()->getRoutes())
|
||||
->map(fn(\Illuminate\Routing\Route $route) => $this->getRoute($route))
|
||||
->merge($this->getFolioRoutes());
|
||||
}
|
||||
|
||||
protected function getFolioRoutes()
|
||||
{
|
||||
try {
|
||||
$output = new \Symfony\Component\Console\Output\BufferedOutput();
|
||||
|
||||
\Illuminate\Support\Facades\Artisan::call("folio:list", ["--json" => true], $output);
|
||||
|
||||
$mountPaths = collect(app(\Laravel\Folio\FolioManager::class)->mountPaths());
|
||||
|
||||
return collect(json_decode($output->fetch(), true))->map(fn($route) => $this->getFolioRoute($route, $mountPaths));
|
||||
} catch (\Exception | \Throwable $e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
protected function getFolioRoute($route, $mountPaths)
|
||||
{
|
||||
if ($mountPaths->count() === 1) {
|
||||
$mountPath = $mountPaths[0];
|
||||
} else {
|
||||
$mountPath = $mountPaths->first(fn($mp) => file_exists($mp->path . DIRECTORY_SEPARATOR . $route['view']));
|
||||
}
|
||||
|
||||
$path = $route['view'];
|
||||
|
||||
if ($mountPath) {
|
||||
$path = $mountPath->path . DIRECTORY_SEPARATOR . $path;
|
||||
}
|
||||
|
||||
return [
|
||||
'method' => $route['method'],
|
||||
'uri' => $route['uri'],
|
||||
'name' => $route['name'],
|
||||
'action' => null,
|
||||
'parameters' => [],
|
||||
'filename' => LaravelVsCode::relativePath($path),
|
||||
'line' => 0,
|
||||
];
|
||||
}
|
||||
|
||||
protected function getRoute(\Illuminate\Routing\Route $route)
|
||||
{
|
||||
try {
|
||||
$reflection = $this->getRouteReflection($route);
|
||||
} catch (\Throwable $e) {
|
||||
$reflection = null;
|
||||
}
|
||||
|
||||
return [
|
||||
'method' => collect($route->methods())
|
||||
->filter(fn($method) => $method !== 'HEAD')
|
||||
->implode('|'),
|
||||
'uri' => $route->uri(),
|
||||
'name' => $route->getName(),
|
||||
'action' => $route->getActionName(),
|
||||
'parameters' => $route->parameterNames(),
|
||||
'filename' => $reflection ? LaravelVsCode::relativePath($reflection->getFileName()) : null,
|
||||
'line' => $reflection ? $reflection->getStartLine() : null,
|
||||
];
|
||||
}
|
||||
|
||||
protected function getRouteReflection(\Illuminate\Routing\Route $route)
|
||||
{
|
||||
if ($route->getActionName() === 'Closure') {
|
||||
return new \ReflectionFunction($route->getAction()['uses']);
|
||||
}
|
||||
|
||||
if (!str_contains($route->getActionName(), '@')) {
|
||||
return new \ReflectionClass($route->getActionName());
|
||||
}
|
||||
|
||||
try {
|
||||
return new \ReflectionMethod($route->getControllerClass(), $route->getActionMethod());
|
||||
} catch (\Throwable $e) {
|
||||
$namespace = app(\Illuminate\Routing\UrlGenerator::class)->getRootControllerNamespace()
|
||||
?? (app()->getNamespace() . 'Http\Controllers');
|
||||
|
||||
return new \ReflectionMethod(
|
||||
$namespace . '\\' . ltrim($route->getControllerClass(), '\\'),
|
||||
$route->getActionMethod(),
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
echo $routes->all()->toJson();
|
||||
|
||||
echo LaravelVsCode::outputMarker('END_OUTPUT');
|
||||
|
||||
exit(0);
|
||||
79
vendor/_laravel_ide/discover-b2238725d3a9b1f49ec262da9e63ff86.php
vendored
Normal file
79
vendor/_laravel_ide/discover-b2238725d3a9b1f49ec262da9e63ff86.php
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
require_once __DIR__ . '/../autoload.php';
|
||||
|
||||
class LaravelVsCode
|
||||
{
|
||||
public static function relativePath($path)
|
||||
{
|
||||
if (!str_contains($path, base_path())) {
|
||||
return (string) $path;
|
||||
}
|
||||
|
||||
return ltrim(str_replace(base_path(), '', realpath($path) ?: $path), DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
public static function isVendor($path)
|
||||
{
|
||||
return str_contains($path, base_path("vendor"));
|
||||
}
|
||||
|
||||
public static function outputMarker($key)
|
||||
{
|
||||
return '__VSCODE_LARAVEL_' . $key . '__';
|
||||
}
|
||||
|
||||
public static function startupError(\Throwable $e)
|
||||
{
|
||||
throw new Error(self::outputMarker('STARTUP_ERROR') . ': ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$app = require_once __DIR__ . '/../../bootstrap/app.php';
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$app->register(new class($app) extends \Illuminate\Support\ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
config([
|
||||
'logging.channels.null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => \Monolog\Handler\NullHandler::class,
|
||||
],
|
||||
'logging.default' => 'null',
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
$kernel->bootstrap();
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo LaravelVsCode::outputMarker('START_OUTPUT');
|
||||
|
||||
echo json_encode([
|
||||
'page_extensions' => config('inertia.page_extensions', config('inertia.testing.page_extensions', [])),
|
||||
'page_paths' => collect(config('inertia.page_paths', config('inertia.testing.page_paths', [])))->flatMap(function($path) {
|
||||
$relativePath = LaravelVsCode::relativePath($path);
|
||||
|
||||
return [$relativePath, mb_strtolower($relativePath)];
|
||||
})->unique()->values(),
|
||||
]);
|
||||
|
||||
echo LaravelVsCode::outputMarker('END_OUTPUT');
|
||||
|
||||
exit(0);
|
||||
306
vendor/_laravel_ide/discover-c3a1d6ece54127a74220acecc54edcc6.php
vendored
Normal file
306
vendor/_laravel_ide/discover-c3a1d6ece54127a74220acecc54edcc6.php
vendored
Normal file
@ -0,0 +1,306 @@
|
||||
<?php
|
||||
|
||||
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
require_once __DIR__ . '/../autoload.php';
|
||||
|
||||
class LaravelVsCode
|
||||
{
|
||||
public static function relativePath($path)
|
||||
{
|
||||
if (!str_contains($path, base_path())) {
|
||||
return (string) $path;
|
||||
}
|
||||
|
||||
return ltrim(str_replace(base_path(), '', realpath($path) ?: $path), DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
public static function isVendor($path)
|
||||
{
|
||||
return str_contains($path, base_path("vendor"));
|
||||
}
|
||||
|
||||
public static function outputMarker($key)
|
||||
{
|
||||
return '__VSCODE_LARAVEL_' . $key . '__';
|
||||
}
|
||||
|
||||
public static function startupError(\Throwable $e)
|
||||
{
|
||||
throw new Error(self::outputMarker('STARTUP_ERROR') . ': ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$app = require_once __DIR__ . '/../../bootstrap/app.php';
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$app->register(new class($app) extends \Illuminate\Support\ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
config([
|
||||
'logging.channels.null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => \Monolog\Handler\NullHandler::class,
|
||||
],
|
||||
'logging.default' => 'null',
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
$kernel->bootstrap();
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo LaravelVsCode::outputMarker('START_OUTPUT');
|
||||
|
||||
$livewire = new class {
|
||||
protected $namespaces;
|
||||
protected $paths;
|
||||
protected $extensions;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->namespaces = collect(
|
||||
config("livewire.component_namespaces", [])
|
||||
)->map(LaravelVsCode::relativePath(...));
|
||||
|
||||
$this->paths = collect($this->namespaces->values())
|
||||
->merge(config("livewire.component_locations", []))
|
||||
->unique()
|
||||
->map(LaravelVsCode::relativePath(...));
|
||||
|
||||
$this->extensions = array_map(
|
||||
fn($extension) => ".{$extension}",
|
||||
app('view')->getExtensions(),
|
||||
);
|
||||
}
|
||||
|
||||
public function parse(\Illuminate\Support\Collection $views)
|
||||
{
|
||||
if (!$this->isVersionFour()) {
|
||||
return $views;
|
||||
}
|
||||
|
||||
return $views
|
||||
->map(function (array $view) {
|
||||
if (!$this->pathExists($view["path"])) {
|
||||
return $view;
|
||||
}
|
||||
|
||||
if (!$this->componentExists($key = $this->key($view))) {
|
||||
return $view;
|
||||
}
|
||||
|
||||
if ($this->isMfc($view) && str($view['path'])->doesntEndWith('.blade.php')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return array_merge($view, [
|
||||
"key" => $key,
|
||||
"isLivewire" => true,
|
||||
]);
|
||||
})
|
||||
->whereNotNull()
|
||||
->unique('key')
|
||||
->values();
|
||||
}
|
||||
|
||||
protected function isVersionFour(): bool
|
||||
{
|
||||
return property_exists(\Livewire\LivewireManager::class, "v4") &&
|
||||
\Livewire\LivewireManager::$v4;
|
||||
}
|
||||
|
||||
protected function pathExists(string $path): bool
|
||||
{
|
||||
return $this->paths->contains(fn (string $item) => str($path)->contains($item));
|
||||
}
|
||||
|
||||
protected function componentExists(string $key): bool
|
||||
{
|
||||
try {
|
||||
app("livewire")->new($key);
|
||||
} catch (\Throwable $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function key(array $view): string
|
||||
{
|
||||
$livewirePath = $this->paths->firstWhere(
|
||||
fn(string $path) => str($view["path"])->startsWith($path)
|
||||
);
|
||||
|
||||
$namespace = $this->namespaces->search($livewirePath);
|
||||
|
||||
return str($view["path"])
|
||||
->replace($livewirePath, "")
|
||||
->replace("⚡", "")
|
||||
->beforeLast(".blade.php")
|
||||
->ltrim(DIRECTORY_SEPARATOR)
|
||||
->replace(DIRECTORY_SEPARATOR, ".")
|
||||
->when($namespace, fn($key) => $key->prepend($namespace . "::"))
|
||||
->when($this->isMfc($view), fn($key) => $key->beforeLast("."))
|
||||
->toString();
|
||||
}
|
||||
|
||||
protected function isMfc(array $view): bool
|
||||
{
|
||||
$path = str($view["path"])->replace("⚡", "");
|
||||
|
||||
$file = str($path)
|
||||
->basename()
|
||||
->beforeLast(".blade.php");
|
||||
|
||||
$directory = str($path)
|
||||
->dirname()
|
||||
->afterLast(DIRECTORY_SEPARATOR);
|
||||
|
||||
$class = str($view["path"])
|
||||
->dirname()
|
||||
->append(DIRECTORY_SEPARATOR . $file . ".php");
|
||||
|
||||
return $file->is($directory) &&
|
||||
\Illuminate\Support\Facades\File::exists($class);
|
||||
}
|
||||
};
|
||||
|
||||
$blade = new class ($livewire) {
|
||||
public function __construct(protected $livewire)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function getAllViews()
|
||||
{
|
||||
$finder = app("view")->getFinder();
|
||||
|
||||
$paths = collect($finder->getPaths())->flatMap(fn($path) => $this->findViews($path));
|
||||
|
||||
$hints = collect($finder->getHints())
|
||||
->filter(
|
||||
fn ($_, $key) => ! (strlen($key) === 32 && ctype_xdigit($key))
|
||||
)->flatMap(
|
||||
fn($paths, $key) => collect($paths)->flatMap(
|
||||
fn($path) => collect($this->findViews($path))->map(
|
||||
fn($value) => array_merge($value, ["key" => "{$key}::{$value["key"]}"])
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
[$local, $vendor] = $paths
|
||||
->merge($hints)
|
||||
->values()
|
||||
->partition(fn($v) => !$v["isVendor"]);
|
||||
|
||||
return $local
|
||||
->sortBy("key", SORT_NATURAL)
|
||||
->merge($vendor->sortBy("key", SORT_NATURAL))
|
||||
->pipe($this->livewire->parse(...));
|
||||
}
|
||||
|
||||
public function getAllComponents()
|
||||
{
|
||||
$namespaced = \Illuminate\Support\Facades\Blade::getClassComponentNamespaces();
|
||||
$autoloaded = require base_path("vendor/composer/autoload_psr4.php");
|
||||
$components = [];
|
||||
|
||||
foreach ($namespaced as $key => $ns) {
|
||||
$path = null;
|
||||
|
||||
foreach ($autoloaded as $namespace => $paths) {
|
||||
if (str_starts_with($ns, $namespace)) {
|
||||
foreach ($paths as $p) {
|
||||
$test = str($ns)->replace($namespace, '')->replace('\\', '/')->prepend($p . DIRECTORY_SEPARATOR)->toString();
|
||||
|
||||
if (is_dir($test)) {
|
||||
$path = $test;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$path) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$files = \Symfony\Component\Finder\Finder::create()
|
||||
->files()
|
||||
->name("*.php")
|
||||
->in($path);
|
||||
|
||||
foreach ($files as $file) {
|
||||
$realPath = $file->getRealPath();
|
||||
|
||||
$components[] = [
|
||||
"path" => str_replace(base_path(DIRECTORY_SEPARATOR), '', $realPath),
|
||||
"isVendor" => str_contains($realPath, base_path("vendor")),
|
||||
"key" => str($realPath)
|
||||
->replace(realpath($path), "")
|
||||
->replace(".php", "")
|
||||
->ltrim(DIRECTORY_SEPARATOR)
|
||||
->replace(DIRECTORY_SEPARATOR, ".")
|
||||
->kebab()
|
||||
->prepend($key . "::"),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $components;
|
||||
}
|
||||
|
||||
protected function findViews($path)
|
||||
{
|
||||
$paths = [];
|
||||
|
||||
if (!is_dir($path)) {
|
||||
return $paths;
|
||||
}
|
||||
|
||||
$finder = app("view")->getFinder();
|
||||
$extensions = array_map(fn($extension) => ".{$extension}", $finder->getExtensions());
|
||||
|
||||
$files = \Symfony\Component\Finder\Finder::create()
|
||||
->files()
|
||||
->name(array_map(fn ($ext) => "*{$ext}", $extensions))
|
||||
->in($path);
|
||||
|
||||
foreach ($files as $file) {
|
||||
$paths[] = [
|
||||
"path" => str_replace(base_path(DIRECTORY_SEPARATOR), '', $file->getRealPath()),
|
||||
"isVendor" => str_contains($file->getRealPath(), base_path("vendor")),
|
||||
"key" => $key = str($file->getRealPath())
|
||||
->replace(realpath($path), "")
|
||||
->replace($extensions, "")
|
||||
->ltrim(DIRECTORY_SEPARATOR)
|
||||
->replace(DIRECTORY_SEPARATOR, "."),
|
||||
"isLivewire" => $key->startsWith("livewire."),
|
||||
];
|
||||
}
|
||||
|
||||
return $paths;
|
||||
}
|
||||
};
|
||||
|
||||
echo json_encode($blade->getAllViews()->merge($blade->getAllComponents()));
|
||||
|
||||
echo LaravelVsCode::outputMarker('END_OUTPUT');
|
||||
|
||||
exit(0);
|
||||
450
vendor/_laravel_ide/discover-d7e0bf33adda1a48ff4c9bdab757e083.php
vendored
Normal file
450
vendor/_laravel_ide/discover-d7e0bf33adda1a48ff4c9bdab757e083.php
vendored
Normal file
@ -0,0 +1,450 @@
|
||||
<?php
|
||||
|
||||
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
require_once __DIR__ . '/../autoload.php';
|
||||
|
||||
class LaravelVsCode
|
||||
{
|
||||
public static function relativePath($path)
|
||||
{
|
||||
if (!str_contains($path, base_path())) {
|
||||
return (string) $path;
|
||||
}
|
||||
|
||||
return ltrim(str_replace(base_path(), '', realpath($path) ?: $path), DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
public static function isVendor($path)
|
||||
{
|
||||
return str_contains($path, base_path("vendor"));
|
||||
}
|
||||
|
||||
public static function outputMarker($key)
|
||||
{
|
||||
return '__VSCODE_LARAVEL_' . $key . '__';
|
||||
}
|
||||
|
||||
public static function startupError(\Throwable $e)
|
||||
{
|
||||
throw new Error(self::outputMarker('STARTUP_ERROR') . ': ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$app = require_once __DIR__ . '/../../bootstrap/app.php';
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$app->register(new class($app) extends \Illuminate\Support\ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
config([
|
||||
'logging.channels.null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => \Monolog\Handler\NullHandler::class,
|
||||
],
|
||||
'logging.default' => 'null',
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
$kernel->bootstrap();
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo LaravelVsCode::outputMarker('START_OUTPUT');
|
||||
|
||||
$translator = new class
|
||||
{
|
||||
public $paths = [];
|
||||
|
||||
public $values = [];
|
||||
|
||||
public $paramResults = [];
|
||||
|
||||
public $params = [];
|
||||
|
||||
public $emptyParams = [];
|
||||
|
||||
public $directoriesToWatch = [];
|
||||
|
||||
public $languages = [];
|
||||
|
||||
public function all()
|
||||
{
|
||||
$final = [];
|
||||
|
||||
foreach ($this->retrieve() as $value) {
|
||||
if ($value instanceof \Illuminate\Support\LazyCollection) {
|
||||
foreach ($value as $val) {
|
||||
$dotKey = $val["k"];
|
||||
$final[$dotKey] ??= [];
|
||||
|
||||
if (!in_array($val["la"], $this->languages)) {
|
||||
$this->languages[] = $val["la"];
|
||||
}
|
||||
|
||||
$final[$dotKey][$val["la"]] = $val["vs"];
|
||||
}
|
||||
} else {
|
||||
foreach ($value["vs"] as $v) {
|
||||
$dotKey = "{$value["k"]}.{$v['k']}";
|
||||
$final[$dotKey] ??= [];
|
||||
|
||||
if (!in_array($value["la"], $this->languages)) {
|
||||
$this->languages[] = $value["la"];
|
||||
}
|
||||
|
||||
$final[$dotKey][$value["la"]] = $v['arr'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $final;
|
||||
}
|
||||
|
||||
protected function retrieve()
|
||||
{
|
||||
$loader = app("translator")->getLoader();
|
||||
$namespaces = $loader->namespaces();
|
||||
|
||||
$paths = $this->getPaths($loader);
|
||||
|
||||
$default = collect($paths)->flatMap(
|
||||
fn($path) => $this->collectFromPath($path)
|
||||
);
|
||||
|
||||
$namespaced = collect($namespaces)->flatMap(
|
||||
fn($path, $namespace) => $this->collectFromPath($path, $namespace)
|
||||
);
|
||||
|
||||
return $default->merge($namespaced);
|
||||
}
|
||||
|
||||
protected function getPaths($loader)
|
||||
{
|
||||
$reflection = new ReflectionClass($loader);
|
||||
$property = null;
|
||||
|
||||
if ($reflection->hasProperty("paths")) {
|
||||
$property = $reflection->getProperty("paths");
|
||||
} else if ($reflection->hasProperty("path")) {
|
||||
$property = $reflection->getProperty("path");
|
||||
}
|
||||
|
||||
if ($property !== null) {
|
||||
$property->setAccessible(true);
|
||||
return \Illuminate\Support\Arr::wrap($property->getValue($loader));
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
public function collectFromPath(string $path, ?string $namespace = null)
|
||||
{
|
||||
$realPath = realpath($path);
|
||||
|
||||
if (!is_dir($realPath)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (!LaravelVsCode::isVendor($realPath)) {
|
||||
$this->directoriesToWatch[] = LaravelVsCode::relativePath($realPath);
|
||||
}
|
||||
|
||||
return array_map(
|
||||
fn($file) => $this->fromFile($file, $path, $namespace),
|
||||
\Illuminate\Support\Facades\File::allFiles($realPath),
|
||||
);
|
||||
}
|
||||
|
||||
protected function fromFile($file, $path, $namespace)
|
||||
{
|
||||
if (pathinfo($file, PATHINFO_EXTENSION) === 'json') {
|
||||
return $this->fromJsonFile($file, $path, $namespace);
|
||||
}
|
||||
|
||||
return $this->fromPhpFile($file, $path, $namespace);
|
||||
}
|
||||
|
||||
protected function linesFromJsonFile($file)
|
||||
{
|
||||
$contents = file_get_contents($file);
|
||||
|
||||
try {
|
||||
$json = json_decode($contents, true) ?? [];
|
||||
} catch (\Throwable $e) {
|
||||
return [[], []];
|
||||
}
|
||||
|
||||
if (count($json) === 0) {
|
||||
return [[], []];
|
||||
}
|
||||
|
||||
$lines = explode(PHP_EOL, $contents);
|
||||
$encoded = array_map(
|
||||
fn($k) => [json_encode($k, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), $k],
|
||||
array_keys($json),
|
||||
);
|
||||
$result = [];
|
||||
$searchRange = 5;
|
||||
|
||||
foreach ($encoded as $index => $keys) {
|
||||
// Pretty likely to be on the line that is the index, go happy path first
|
||||
if (strpos($lines[$index + 1] ?? '', $keys[0]) !== false) {
|
||||
$result[$keys[1]] = $index + 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Search around the index, likely to be within $searchRange lines
|
||||
$start = max(0, $index - $searchRange);
|
||||
$end = min($index + $searchRange, count($lines) - 1);
|
||||
$current = $start;
|
||||
|
||||
while ($current <= $end) {
|
||||
if (strpos($lines[$current], $keys[0]) !== false) {
|
||||
$result[$keys[1]] = $current + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
$current++;
|
||||
}
|
||||
}
|
||||
|
||||
return [$json, $result];
|
||||
}
|
||||
|
||||
protected function linesFromPhpFile($file)
|
||||
{
|
||||
$tokens = token_get_all(file_get_contents($file));
|
||||
$found = [];
|
||||
|
||||
$inArrayKey = true;
|
||||
$arrayDepth = -1;
|
||||
$depthKeys = [];
|
||||
|
||||
foreach ($tokens as $index => $token) {
|
||||
if (!is_array($token)) {
|
||||
if ($token === '[') {
|
||||
$inArrayKey = true;
|
||||
$currentIndex = 0;
|
||||
$arrayDepth++;
|
||||
}
|
||||
|
||||
if ($token === ']') {
|
||||
$inArrayKey = true;
|
||||
$arrayDepth--;
|
||||
array_pop($depthKeys);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($token[0] === T_DOUBLE_ARROW) {
|
||||
$inArrayKey = false;
|
||||
}
|
||||
|
||||
if ($inArrayKey && $token[0] === T_CONSTANT_ENCAPSED_STRING) {
|
||||
$nextToken = isset($tokens[$index + 1]) ? $tokens[$index + 1] : null;
|
||||
$nextValue = isset($nextToken[1]) ? $nextToken[1] : $nextToken;
|
||||
|
||||
if ($nextValue === ',' || str_contains($nextValue, "\n")) {
|
||||
$token[1] = $currentIndex;
|
||||
|
||||
$currentIndex++;
|
||||
}
|
||||
|
||||
$depthKeys[$arrayDepth] = trim($token[1], '"\'');
|
||||
|
||||
\Illuminate\Support\Arr::set($found, implode('.', $depthKeys), $token[2]);
|
||||
}
|
||||
|
||||
if (!$inArrayKey && $token[0] === T_CONSTANT_ENCAPSED_STRING) {
|
||||
$inArrayKey = true;
|
||||
}
|
||||
}
|
||||
|
||||
return \Illuminate\Support\Arr::dot($found);
|
||||
}
|
||||
|
||||
protected function getDotted($key, $lang)
|
||||
{
|
||||
try {
|
||||
return \Illuminate\Support\Arr::dot(
|
||||
\Illuminate\Support\Arr::wrap(
|
||||
__($key, [], $lang),
|
||||
),
|
||||
);
|
||||
} catch (\Throwable $e) {
|
||||
// Most likely, in this case, the lang file doesn't return an array
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
protected function getPathIndex($file)
|
||||
{
|
||||
$path = LaravelVsCode::relativePath($file);
|
||||
|
||||
$index = $this->paths[$path] ?? null;
|
||||
|
||||
if ($index !== null) {
|
||||
return $index;
|
||||
}
|
||||
|
||||
$this->paths[$path] = count($this->paths);
|
||||
|
||||
return $this->paths[$path];
|
||||
}
|
||||
|
||||
protected function getValueIndex($value)
|
||||
{
|
||||
$index = $this->values[$value] ?? null;
|
||||
|
||||
if ($index !== null) {
|
||||
return $index;
|
||||
}
|
||||
|
||||
$this->values[$value] = count($this->values);
|
||||
|
||||
return $this->values[$value];
|
||||
}
|
||||
|
||||
protected function getParamIndex($key)
|
||||
{
|
||||
$processed = $this->params[$key] ?? null;
|
||||
|
||||
if ($processed) {
|
||||
return $processed[0];
|
||||
}
|
||||
|
||||
if (in_array($key, $this->emptyParams)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$params = preg_match_all("/\:([A-Za-z0-9_]+)/", $key, $matches)
|
||||
? $matches[1]
|
||||
: [];
|
||||
|
||||
if (count($params) === 0) {
|
||||
$this->emptyParams[] = $key;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$paramKey = json_encode($params);
|
||||
|
||||
$paramIndex = $this->paramResults[$paramKey] ?? null;
|
||||
|
||||
if ($paramIndex !== null) {
|
||||
$this->params[$key] = [$paramIndex, $params];
|
||||
|
||||
return $paramIndex;
|
||||
}
|
||||
|
||||
$paramIndex = count($this->paramResults);
|
||||
|
||||
$this->paramResults[$paramKey] = $paramIndex;
|
||||
|
||||
$this->params[$key] = [$paramIndex, $params];
|
||||
|
||||
return $paramIndex;
|
||||
}
|
||||
|
||||
protected function fromJsonFile($file, $path, $namespace)
|
||||
{
|
||||
$lang = pathinfo($file, PATHINFO_FILENAME);
|
||||
|
||||
$relativePath = $this->getPathIndex($file);
|
||||
|
||||
$lines = \Illuminate\Support\Facades\File::lines($file);
|
||||
|
||||
return \Illuminate\Support\LazyCollection::make(function () use ($file, $lang, $relativePath, $lines) {
|
||||
[$json, $lines] = $this->linesFromJsonFile($file);
|
||||
|
||||
foreach ($json as $key => $value) {
|
||||
if (!array_key_exists($key, $lines) || is_array($value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
yield [
|
||||
"k" => $key,
|
||||
"la" => $lang,
|
||||
"vs" => [
|
||||
$this->getValueIndex($value),
|
||||
$relativePath,
|
||||
$lines[$key] ?? null,
|
||||
$this->getParamIndex($key),
|
||||
],
|
||||
];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected function fromPhpFile($file, $path, $namespace)
|
||||
{
|
||||
$lang = str($file)
|
||||
->after($path.DIRECTORY_SEPARATOR)
|
||||
->before(DIRECTORY_SEPARATOR)
|
||||
->value();
|
||||
|
||||
$key = str($file)
|
||||
->after($path.DIRECTORY_SEPARATOR)
|
||||
->after(DIRECTORY_SEPARATOR)
|
||||
->replaceLast('.php', '')
|
||||
->value();
|
||||
|
||||
if ($namespace) {
|
||||
$key = "{$namespace}::{$key}";
|
||||
}
|
||||
|
||||
$relativePath = $this->getPathIndex($file);
|
||||
$lines = $this->linesFromPhpFile($file);
|
||||
|
||||
return [
|
||||
"k" => $key,
|
||||
"la" => $lang,
|
||||
"vs" => \Illuminate\Support\LazyCollection::make(function () use ($key, $lang, $relativePath, $lines) {
|
||||
foreach ($this->getDotted($key, [], $lang) as $key => $value) {
|
||||
if (!array_key_exists($key, $lines) || is_array($value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
yield [
|
||||
'k' => $key,
|
||||
'arr' => [
|
||||
$this->getValueIndex($value),
|
||||
$relativePath,
|
||||
$lines[$key],
|
||||
$this->getParamIndex($value),
|
||||
],
|
||||
];
|
||||
}
|
||||
}),
|
||||
];
|
||||
}
|
||||
};
|
||||
|
||||
echo json_encode([
|
||||
'default' => \Illuminate\Support\Facades\App::currentLocale(),
|
||||
'translations' => $translator->all(),
|
||||
'languages' => $translator->languages,
|
||||
'paths' => array_keys($translator->paths),
|
||||
'values' => array_keys($translator->values),
|
||||
'params' => array_map(fn($p) => json_decode($p, true), array_keys($translator->paramResults)),
|
||||
'to_watch' => $translator->directoriesToWatch,
|
||||
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
|
||||
echo LaravelVsCode::outputMarker('END_OUTPUT');
|
||||
|
||||
exit(0);
|
||||
142
vendor/_laravel_ide/discover-f5442aeac73a6a9021bd7ce113d6a606.php
vendored
Normal file
142
vendor/_laravel_ide/discover-f5442aeac73a6a9021bd7ce113d6a606.php
vendored
Normal file
@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
require_once __DIR__ . '/../autoload.php';
|
||||
|
||||
class LaravelVsCode
|
||||
{
|
||||
public static function relativePath($path)
|
||||
{
|
||||
if (!str_contains($path, base_path())) {
|
||||
return (string) $path;
|
||||
}
|
||||
|
||||
return ltrim(str_replace(base_path(), '', realpath($path) ?: $path), DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
public static function isVendor($path)
|
||||
{
|
||||
return str_contains($path, base_path("vendor"));
|
||||
}
|
||||
|
||||
public static function outputMarker($key)
|
||||
{
|
||||
return '__VSCODE_LARAVEL_' . $key . '__';
|
||||
}
|
||||
|
||||
public static function startupError(\Throwable $e)
|
||||
{
|
||||
throw new Error(self::outputMarker('STARTUP_ERROR') . ': ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$app = require_once __DIR__ . '/../../bootstrap/app.php';
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$app->register(new class($app) extends \Illuminate\Support\ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
config([
|
||||
'logging.channels.null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => \Monolog\Handler\NullHandler::class,
|
||||
],
|
||||
'logging.default' => 'null',
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
$kernel->bootstrap();
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo LaravelVsCode::outputMarker('START_OUTPUT');
|
||||
|
||||
function vsCodeGetReflectionMethod(ReflectionClass $reflected): ReflectionMethod {
|
||||
return match (true) {
|
||||
$reflected->hasMethod('__invoke') => $reflected->getMethod('__invoke'),
|
||||
default => $reflected->getMethod('handle'),
|
||||
};
|
||||
}
|
||||
|
||||
echo collect(app("Illuminate\Contracts\Http\Kernel")->getMiddlewareGroups())
|
||||
->merge(app("Illuminate\Contracts\Http\Kernel")->getRouteMiddleware())
|
||||
->merge(app("router")->getMiddleware())
|
||||
->map(function ($middleware, $key) {
|
||||
$result = [
|
||||
"class" => null,
|
||||
"path" => null,
|
||||
"line" => null,
|
||||
"parameters" => null,
|
||||
"groups" => [],
|
||||
];
|
||||
|
||||
if (is_array($middleware)) {
|
||||
$result["groups"] = collect($middleware)->map(function ($m) {
|
||||
if (!class_exists($m)) {
|
||||
return [
|
||||
"class" => $m,
|
||||
"path" => null,
|
||||
"line" => null
|
||||
];
|
||||
}
|
||||
|
||||
$reflected = new ReflectionClass($m);
|
||||
$reflectedMethod = vsCodeGetReflectionMethod($reflected);
|
||||
|
||||
return [
|
||||
"class" => $m,
|
||||
"path" => LaravelVsCode::relativePath($reflected->getFileName()),
|
||||
"line" =>
|
||||
$reflectedMethod->getFileName() === $reflected->getFileName()
|
||||
? $reflectedMethod->getStartLine()
|
||||
: null
|
||||
];
|
||||
})->all();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
$reflected = new ReflectionClass($middleware);
|
||||
$reflectedMethod = vsCodeGetReflectionMethod($reflected);
|
||||
|
||||
$result = array_merge($result, [
|
||||
"class" => $middleware,
|
||||
"path" => LaravelVsCode::relativePath($reflected->getFileName()),
|
||||
"line" => $reflectedMethod->getStartLine(),
|
||||
]);
|
||||
|
||||
$parameters = collect($reflectedMethod->getParameters())
|
||||
->filter(function ($rc) {
|
||||
return $rc->getName() !== "request" && $rc->getName() !== "next";
|
||||
})
|
||||
->map(function ($rc) {
|
||||
return $rc->getName() . ($rc->isVariadic() ? "..." : "");
|
||||
});
|
||||
|
||||
if ($parameters->isEmpty()) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
return array_merge($result, [
|
||||
"parameters" => $parameters->implode(",")
|
||||
]);
|
||||
})
|
||||
->toJson();
|
||||
|
||||
echo LaravelVsCode::outputMarker('END_OUTPUT');
|
||||
|
||||
exit(0);
|
||||
175
vendor/_laravel_ide/discover-f613d6a3d267805582334742522e87f1.php
vendored
Normal file
175
vendor/_laravel_ide/discover-f613d6a3d267805582334742522e87f1.php
vendored
Normal file
@ -0,0 +1,175 @@
|
||||
<?php
|
||||
|
||||
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
require_once __DIR__ . '/../autoload.php';
|
||||
|
||||
class LaravelVsCode
|
||||
{
|
||||
public static function relativePath($path)
|
||||
{
|
||||
if (!str_contains($path, base_path())) {
|
||||
return (string) $path;
|
||||
}
|
||||
|
||||
return ltrim(str_replace(base_path(), '', realpath($path) ?: $path), DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
public static function isVendor($path)
|
||||
{
|
||||
return str_contains($path, base_path("vendor"));
|
||||
}
|
||||
|
||||
public static function outputMarker($key)
|
||||
{
|
||||
return '__VSCODE_LARAVEL_' . $key . '__';
|
||||
}
|
||||
|
||||
public static function startupError(\Throwable $e)
|
||||
{
|
||||
throw new Error(self::outputMarker('STARTUP_ERROR') . ': ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$app = require_once __DIR__ . '/../../bootstrap/app.php';
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$app->register(new class($app) extends \Illuminate\Support\ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
config([
|
||||
'logging.channels.null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => \Monolog\Handler\NullHandler::class,
|
||||
],
|
||||
'logging.default' => 'null',
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
$kernel->bootstrap();
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo LaravelVsCode::outputMarker('START_OUTPUT');
|
||||
|
||||
if (!\Illuminate\Support\Facades\App::bound('auth')) {
|
||||
echo json_encode([
|
||||
'authenticatable' => null,
|
||||
'policies' => (object) [],
|
||||
]);
|
||||
} else {
|
||||
if (\Illuminate\Support\Facades\File::isDirectory(base_path('app/Models'))) {
|
||||
collect(\Illuminate\Support\Facades\File::allFiles(base_path('app/Models')))
|
||||
->filter(fn(\Symfony\Component\Finder\SplFileInfo $file) => $file->getExtension() === 'php')
|
||||
->each(fn($file) => include_once($file));
|
||||
}
|
||||
|
||||
$modelPolicies = collect(get_declared_classes())
|
||||
->filter(fn($class) => is_subclass_of($class, \Illuminate\Database\Eloquent\Model::class))
|
||||
->filter(fn($class) => !in_array($class, [
|
||||
\Illuminate\Database\Eloquent\Relations\Pivot::class,
|
||||
\Illuminate\Foundation\Auth\User::class,
|
||||
]))
|
||||
->flatMap(fn($class) => [
|
||||
$class => \Illuminate\Support\Facades\Gate::getPolicyFor($class),
|
||||
])
|
||||
->filter(fn($policy) => $policy !== null);
|
||||
|
||||
function vsCodeGetAuthenticatable() {
|
||||
try {
|
||||
$guard = auth()->guard();
|
||||
|
||||
$reflection = new \ReflectionClass($guard);
|
||||
|
||||
if (!$reflection->hasProperty("provider")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$property = $reflection->getProperty("provider");
|
||||
$provider = $property->getValue($guard);
|
||||
|
||||
if ($provider instanceof \Illuminate\Auth\EloquentUserProvider) {
|
||||
$providerReflection = new \ReflectionClass($provider);
|
||||
$modelProperty = $providerReflection->getProperty("model");
|
||||
|
||||
return str($modelProperty->getValue($provider))->prepend("\\")->toString();
|
||||
}
|
||||
|
||||
if ($provider instanceof \Illuminate\Auth\DatabaseUserProvider) {
|
||||
return str(\Illuminate\Auth\GenericUser::class)->prepend("\\")->toString();
|
||||
}
|
||||
} catch (\Exception | \Throwable $e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function vsCodeGetPolicyInfo($policy, $model)
|
||||
{
|
||||
$methods = (new ReflectionClass($policy))->getMethods();
|
||||
|
||||
return collect($methods)->map(fn(ReflectionMethod $method) => [
|
||||
'key' => $method->getName(),
|
||||
'uri' => $method->getFileName(),
|
||||
'policy' => is_string($policy) ? $policy : get_class($policy),
|
||||
'model' => $model,
|
||||
'line' => $method->getStartLine(),
|
||||
])->filter(fn($ability) => !in_array($ability['key'], ['allow', 'deny']));
|
||||
}
|
||||
|
||||
echo json_encode([
|
||||
'authenticatable' => vsCodeGetAuthenticatable(),
|
||||
'policies' => collect(\Illuminate\Support\Facades\Gate::abilities())
|
||||
->map(function ($policy, $key) {
|
||||
$reflection = new \ReflectionFunction($policy);
|
||||
$policyClass = null;
|
||||
$closureThis = $reflection->getClosureThis();
|
||||
|
||||
if ($closureThis !== null) {
|
||||
if (get_class($closureThis) === \Illuminate\Auth\Access\Gate::class) {
|
||||
$vars = $reflection->getClosureUsedVariables();
|
||||
|
||||
if (isset($vars['callback'])) {
|
||||
[$policyClass, $method] = explode('@', $vars['callback']);
|
||||
|
||||
$reflection = new \ReflectionMethod($policyClass, $method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'key' => $key,
|
||||
'uri' => $reflection->getFileName(),
|
||||
'policy' => $policyClass,
|
||||
'line' => $reflection->getStartLine(),
|
||||
];
|
||||
})
|
||||
->merge(
|
||||
collect(\Illuminate\Support\Facades\Gate::policies())->flatMap(fn($policy, $model) => vsCodeGetPolicyInfo($policy, $model)),
|
||||
)
|
||||
->merge(
|
||||
$modelPolicies->flatMap(fn($policy, $model) => vsCodeGetPolicyInfo($policy, $model)),
|
||||
)
|
||||
->values()
|
||||
->groupBy('key')
|
||||
->map(fn($item) => $item->map(fn($i) => \Illuminate\Support\Arr::except($i, 'key'))),
|
||||
]);
|
||||
}
|
||||
|
||||
echo LaravelVsCode::outputMarker('END_OUTPUT');
|
||||
|
||||
exit(0);
|
||||
383
vendor/_laravel_ide/discover-f6c2bb05e77ee582c501379f6998f2c4.php
vendored
Normal file
383
vendor/_laravel_ide/discover-f6c2bb05e77ee582c501379f6998f2c4.php
vendored
Normal file
@ -0,0 +1,383 @@
|
||||
<?php
|
||||
|
||||
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
require_once __DIR__ . '/../autoload.php';
|
||||
|
||||
class LaravelVsCode
|
||||
{
|
||||
public static function relativePath($path)
|
||||
{
|
||||
if (!str_contains($path, base_path())) {
|
||||
return (string) $path;
|
||||
}
|
||||
|
||||
return ltrim(str_replace(base_path(), '', realpath($path) ?: $path), DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
public static function isVendor($path)
|
||||
{
|
||||
return str_contains($path, base_path("vendor"));
|
||||
}
|
||||
|
||||
public static function outputMarker($key)
|
||||
{
|
||||
return '__VSCODE_LARAVEL_' . $key . '__';
|
||||
}
|
||||
|
||||
public static function startupError(\Throwable $e)
|
||||
{
|
||||
throw new Error(self::outputMarker('STARTUP_ERROR') . ': ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$app = require_once __DIR__ . '/../../bootstrap/app.php';
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$app->register(new class($app) extends \Illuminate\Support\ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
config([
|
||||
'logging.channels.null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => \Monolog\Handler\NullHandler::class,
|
||||
],
|
||||
'logging.default' => 'null',
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
$kernel->bootstrap();
|
||||
} catch (\Throwable $e) {
|
||||
LaravelVsCode::startupError($e);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo LaravelVsCode::outputMarker('START_OUTPUT');
|
||||
|
||||
$components = new class {
|
||||
protected $autoloaded = [];
|
||||
|
||||
protected $prefixes = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->autoloaded = require base_path("vendor/composer/autoload_psr4.php");
|
||||
}
|
||||
|
||||
public function all()
|
||||
{
|
||||
$components = collect(array_merge(
|
||||
$this->getStandardClasses(),
|
||||
$this->getStandardViews(),
|
||||
$this->getNamespaced(),
|
||||
$this->getAnonymousNamespaced(),
|
||||
$this->getAnonymous(),
|
||||
$this->getAliases(),
|
||||
$this->getVendorComponents(),
|
||||
))->groupBy('key')->map(fn($items) => [
|
||||
'isVendor' => $items->first()['isVendor'],
|
||||
'paths' => $items->pluck('path')->values(),
|
||||
'props' => $items->pluck('props')->values()->filter()->flatMap(fn($i) => $i),
|
||||
]);
|
||||
|
||||
return [
|
||||
'components' => $components,
|
||||
'prefixes' => $this->prefixes,
|
||||
];
|
||||
}
|
||||
|
||||
protected function getStandardViews()
|
||||
{
|
||||
$path = resource_path('views/components');
|
||||
|
||||
return $this->findFiles($path, 'blade.php');
|
||||
}
|
||||
|
||||
protected function findFiles($path, $extension, $keyCallback = null)
|
||||
{
|
||||
if (!is_dir($path)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$files = \Symfony\Component\Finder\Finder::create()
|
||||
->files()
|
||||
->name("*." . $extension)
|
||||
->in($path);
|
||||
$components = [];
|
||||
$pathRealPath = realpath($path);
|
||||
|
||||
foreach ($files as $file) {
|
||||
$realPath = $file->getRealPath();
|
||||
|
||||
$key = str($realPath)
|
||||
->replace($pathRealPath, '')
|
||||
->ltrim('/\\')
|
||||
->replace('.' . $extension, '')
|
||||
->replace(['/', '\\'], '.')
|
||||
->pipe(fn($str) => $this->handleIndexComponents($str));
|
||||
|
||||
$components[] = [
|
||||
"path" => LaravelVsCode::relativePath($realPath),
|
||||
"isVendor" => LaravelVsCode::isVendor($realPath),
|
||||
"key" => $keyCallback ? $keyCallback($key) : $key,
|
||||
];
|
||||
}
|
||||
|
||||
return $components;
|
||||
}
|
||||
|
||||
protected function getStandardClasses()
|
||||
{
|
||||
$path = app_path('View/Components');
|
||||
|
||||
$appNamespace = collect($this->autoloaded)
|
||||
->filter(fn($paths) => in_array(app_path(), $paths))
|
||||
->keys()
|
||||
->first() ?? '';
|
||||
|
||||
return collect($this->findFiles(
|
||||
$path,
|
||||
'php',
|
||||
fn($key) => $key->explode('.')
|
||||
->map(fn($p) => \Illuminate\Support\Str::kebab($p))
|
||||
->implode('.'),
|
||||
))->map(function ($item) use ($appNamespace) {
|
||||
$class = str($item['path'])
|
||||
->after('View/Components/')
|
||||
->replace('.php', '')
|
||||
->replace('/', '\\')
|
||||
->prepend($appNamespace . 'View\\Components\\')
|
||||
->toString();
|
||||
|
||||
if (!class_exists($class)) {
|
||||
return $item;
|
||||
}
|
||||
|
||||
$reflection = new \ReflectionClass($class);
|
||||
$parameters = collect($reflection->getConstructor()?->getParameters() ?? [])
|
||||
->filter(fn($p) => $p->isPromoted())
|
||||
->flatMap(fn($p) => [$p->getName() => $p->isOptional() ? $p->getDefaultValue() : null])
|
||||
->all();
|
||||
|
||||
$props = collect($reflection->getProperties())
|
||||
->filter(fn($p) => $p->isPublic() && $p->getDeclaringClass()->getName() === $class)
|
||||
->map(fn($p) => [
|
||||
'name' => \Illuminate\Support\Str::kebab($p->getName()),
|
||||
'type' => (string) ($p->getType() ?? 'mixed'),
|
||||
'default' => $p->getDefaultValue() ?? $parameters[$p->getName()] ?? null,
|
||||
]);
|
||||
|
||||
[$except, $props] = $props->partition(fn($p) => $p['name'] === 'except');
|
||||
|
||||
if ($except->isNotEmpty()) {
|
||||
$except = $except->first()['default'];
|
||||
$props = $props->reject(fn($p) => in_array($p['name'], $except));
|
||||
}
|
||||
|
||||
return [
|
||||
...$item,
|
||||
'props' => $props,
|
||||
];
|
||||
})->all();
|
||||
}
|
||||
|
||||
protected function getAliases()
|
||||
{
|
||||
$components = [];
|
||||
|
||||
foreach (\Illuminate\Support\Facades\Blade::getClassComponentAliases() as $key => $class) {
|
||||
if (class_exists($class)) {
|
||||
$reflection = new ReflectionClass($class);
|
||||
|
||||
$components[] = [
|
||||
"path" => LaravelVsCode::relativePath($reflection->getFileName()),
|
||||
"isVendor" => LaravelVsCode::isVendor($reflection->getFileName()),
|
||||
"key" => $key,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $components;
|
||||
}
|
||||
|
||||
protected function getAnonymousNamespaced()
|
||||
{
|
||||
$components = [];
|
||||
|
||||
foreach (\Illuminate\Support\Facades\Blade::getAnonymousComponentNamespaces() as $key => $dir) {
|
||||
$path = collect([$dir, resource_path('views/' . $dir)])->first(fn($p) => is_dir($p));
|
||||
|
||||
if (!$path) {
|
||||
continue;
|
||||
}
|
||||
|
||||
array_push(
|
||||
$components,
|
||||
...$this->findFiles(
|
||||
$path,
|
||||
'blade.php',
|
||||
fn($k) => $k->kebab()->prepend($key . "::"),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $components;
|
||||
}
|
||||
|
||||
protected function getAnonymous()
|
||||
{
|
||||
$components = [];
|
||||
|
||||
foreach (\Illuminate\Support\Facades\Blade::getAnonymousComponentPaths() as $item) {
|
||||
array_push(
|
||||
$components,
|
||||
...$this->findFiles(
|
||||
$item['path'],
|
||||
'blade.php',
|
||||
function (\Illuminate\Support\Stringable $key) use ($item) {
|
||||
$prefix = $item['prefix'] ? $item['prefix'] . '::' : '';
|
||||
$key = $key->kebab();
|
||||
$keys = [];
|
||||
|
||||
$keys[] = $key->prepend($prefix);
|
||||
|
||||
if ($item['prefix'] === 'flux') {
|
||||
$keys[] = $key->prepend('flux:');
|
||||
}
|
||||
|
||||
return $keys;
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
if (!in_array($item['prefix'], $this->prefixes)) {
|
||||
$this->prefixes[] = $item['prefix'];
|
||||
}
|
||||
}
|
||||
|
||||
return $components;
|
||||
}
|
||||
|
||||
protected function getVendorComponents(): array
|
||||
{
|
||||
$components = [];
|
||||
|
||||
/** @var \Illuminate\View\Factory $view */
|
||||
$view = \Illuminate\Support\Facades\App::make('view');
|
||||
|
||||
/** @var \Illuminate\View\FileViewFinder $finder */
|
||||
$finder = $view->getFinder();
|
||||
|
||||
/** @var array<string, array<int, string>> $views */
|
||||
$views = $finder->getHints();
|
||||
|
||||
foreach ($views as $key => $paths) {
|
||||
foreach ($paths as $path) {
|
||||
$path .= '/components';
|
||||
|
||||
if (!is_dir($path)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
array_push(
|
||||
$components,
|
||||
...$this->findFiles(
|
||||
$path,
|
||||
'blade.php',
|
||||
fn (\Illuminate\Support\Stringable $k) => $k->kebab()->prepend($key.'::'),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $components;
|
||||
}
|
||||
|
||||
protected function handleIndexComponents($str)
|
||||
{
|
||||
if ($str->endsWith('.index')) {
|
||||
return $str->replaceLast('.index', '');
|
||||
}
|
||||
|
||||
if (!$str->contains('.')) {
|
||||
return $str;
|
||||
}
|
||||
|
||||
$parts = $str->explode('.');
|
||||
|
||||
if ($parts->slice(-2)->unique()->count() === 1) {
|
||||
$parts->pop();
|
||||
|
||||
return str($parts->implode('.'));
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
protected function getNamespaced()
|
||||
{
|
||||
$namespaced = \Illuminate\Support\Facades\Blade::getClassComponentNamespaces();
|
||||
$components = [];
|
||||
|
||||
foreach ($namespaced as $key => $classNamespace) {
|
||||
$path = $this->getNamespacePath($classNamespace);
|
||||
|
||||
if (!$path) {
|
||||
continue;
|
||||
}
|
||||
|
||||
array_push(
|
||||
$components,
|
||||
...$this->findFiles(
|
||||
$path,
|
||||
'php',
|
||||
fn($k) => $k->kebab()->prepend($key . "::"),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $components;
|
||||
}
|
||||
|
||||
protected function getNamespacePath($classNamespace)
|
||||
{
|
||||
foreach ($this->autoloaded as $ns => $paths) {
|
||||
if (!str_starts_with($classNamespace, $ns)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($paths as $p) {
|
||||
$dir = str($classNamespace)
|
||||
->replace($ns, '')
|
||||
->replace('\\', '/')
|
||||
->prepend($p . DIRECTORY_SEPARATOR)
|
||||
->toString();
|
||||
|
||||
if (is_dir($dir)) {
|
||||
return $dir;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
echo json_encode($components->all());
|
||||
|
||||
echo LaravelVsCode::outputMarker('END_OUTPUT');
|
||||
|
||||
exit(0);
|
||||
Loading…
x
Reference in New Issue
Block a user