Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php declare(strict_types=1); namespace Larastan\Larastan\Internal; use Illuminate\Con..
Decoded Output download
<?php
declare(strict_types=1);
namespace Larastan\Larastan\Internal;
use Illuminate\Console\Application;
use Illuminate\Console\Command;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Events\Dispatcher;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Type\ObjectType;
use function app;
/** @internal */
final class ConsoleApplicationResolver
{
private Application|null $application = null;
/** @return Command[] */
public function findCommands(ClassReflection $classReflection): array
{
$consoleApplication = $this->getApplication();
$classType = new ObjectType($classReflection->getName());
if (! (new ObjectType('Illuminate\Console\Command'))->isSuperTypeOf($classType)->yes()) {
return [];
}
$commands = [];
foreach ($consoleApplication->all() as $name => $command) {
if (! $classType->isSuperTypeOf(new ObjectType($command::class))->yes()) {
continue;
}
$commands[$name] = $command;
}
return $commands; // @phpstan-ignore-line
}
private function getApplication(): Application
{
if ($this->application === null) {
$this->application = new Application(app(Container::class), app(Dispatcher::class), app()->version());
}
return $this->application;
}
}
?>
Did this file decode correctly?
Original Code
<?php
declare(strict_types=1);
namespace Larastan\Larastan\Internal;
use Illuminate\Console\Application;
use Illuminate\Console\Command;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Events\Dispatcher;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Type\ObjectType;
use function app;
/** @internal */
final class ConsoleApplicationResolver
{
private Application|null $application = null;
/** @return Command[] */
public function findCommands(ClassReflection $classReflection): array
{
$consoleApplication = $this->getApplication();
$classType = new ObjectType($classReflection->getName());
if (! (new ObjectType('Illuminate\Console\Command'))->isSuperTypeOf($classType)->yes()) {
return [];
}
$commands = [];
foreach ($consoleApplication->all() as $name => $command) {
if (! $classType->isSuperTypeOf(new ObjectType($command::class))->yes()) {
continue;
}
$commands[$name] = $command;
}
return $commands; // @phpstan-ignore-line
}
private function getApplication(): Application
{
if ($this->application === null) {
$this->application = new Application(app(Container::class), app(Dispatcher::class), app()->version());
}
return $this->application;
}
}
Function Calls
| None |
Stats
| MD5 | 74c46e7dec170547a7542fef9f9adfa9 |
| Eval Count | 0 |
| Decode Time | 98 ms |