clean up comments

This commit is contained in:
Pig Fang 2020-06-24 15:25:36 +08:00
parent 98714a8851
commit 78c1373960
39 changed files with 21 additions and 396 deletions

View File

@ -7,25 +7,10 @@ use Illuminate\Console\Command;
class PluginDisableCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'plugin:disable {name}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Disable a plugin';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle(PluginManager $plugins)
{
$plugin = $plugins->get($this->argument('name'));

View File

@ -7,25 +7,10 @@ use Illuminate\Console\Command;
class PluginEnableCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'plugin:enable {name}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Enable a plugin';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle(PluginManager $plugins)
{
$name = $this->argument('name');

View File

@ -6,25 +6,10 @@ use Illuminate\Console\Command;
class SaltRandomCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'salt:random {--show : Display the salt instead of modifying files}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Set the application salt';
/**
* Execute the console command.
*
* @return void
*/
public function handle()
{
$salt = $this->generateRandomSalt();
@ -43,14 +28,7 @@ class SaltRandomCommand extends Command
$this->info("Application salt [$salt] set successfully.");
}
/**
* Set the application salt in the environment file.
*
* @param string $salt
*
* @return void
*/
protected function setKeyInEnvironmentFile($salt)
protected function setKeyInEnvironmentFile(string $salt)
{
file_put_contents($this->laravel->environmentFilePath(), str_replace(
'SALT = '.$this->laravel['config']['secure.salt'],
@ -59,12 +37,7 @@ class SaltRandomCommand extends Command
));
}
/**
* Generate a random salt for the application.
*
* @return string
*/
protected function generateRandomSalt()
protected function generateRandomSalt(): string
{
return bin2hex(resolve(\Illuminate\Contracts\Encryption\Encrypter::class)->generateKey('AES-128-CBC'));
}

View File

@ -6,11 +6,6 @@ class ConfigureAdminMenu extends Event
{
public $menu;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(array &$menu)
{
// Pass array by reference

View File

@ -6,11 +6,6 @@ class ConfigureExploreMenu extends Event
{
public $menu;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(array &$menu)
{
// Pass array by reference

View File

@ -8,11 +8,6 @@ class ConfigureRoutes extends Event
{
public $router;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Router $router)
{
$this->router = $router;

View File

@ -6,14 +6,8 @@ class ConfigureUserMenu extends Event
{
public $menu;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(array &$menu)
{
// Pass array by reference
$this->menu = &$menu;
}
}

View File

@ -8,11 +8,6 @@ class PlayerProfileUpdated extends Event
{
public $player;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Player $player)
{
$this->player = $player;

View File

@ -8,11 +8,6 @@ class PlayerWasAdded extends Event
{
public $player;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Player $player)
{
$this->player = $player;

View File

@ -6,13 +6,6 @@ class PlayerWasDeleted extends Event
{
public $playerName;
/**
* Create a new event instance.
*
* @param string $playerName
*
* @return void
*/
public function __construct($playerName)
{
$this->playerName = $playerName;

View File

@ -6,13 +6,6 @@ class PlayerWillBeAdded extends Event
{
public $playerName;
/**
* Create a new event instance.
*
* @param string $playerName
*
* @return void
*/
public function __construct($playerName)
{
$this->playerName = $playerName;

View File

@ -8,11 +8,6 @@ class PlayerWillBeDeleted extends Event
{
public $player;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Player $player)
{
$this->player = $player;

View File

@ -8,11 +8,6 @@ class PluginWasDeleted extends Event
{
public $plugin;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Plugin $plugin)
{
$this->plugin = $plugin;

View File

@ -8,11 +8,6 @@ class PluginWasDisabled extends Event
{
public $plugin;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Plugin $plugin)
{
$this->plugin = $plugin;

View File

@ -8,11 +8,6 @@ class PluginWasEnabled extends Event
{
public $plugin;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Plugin $plugin)
{
$this->plugin = $plugin;

View File

@ -6,25 +6,12 @@ class RenderingFooter extends Event
{
public $contents;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(array &$contents)
{
// Pass array by reference
$this->contents = &$contents;
}
/**
* Add content to page footer.
*
* @param string $content
*
* @return void
*/
public function addContent($content)
public function addContent(string $content)
{
if ($content) {
if (!is_string($content)) {

View File

@ -6,25 +6,12 @@ class RenderingHeader extends Event
{
public $contents;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(array &$contents)
{
// Pass array by reference
$this->contents = &$contents;
}
/**
* Add content to page footer.
*
* @param string $content
*
* @return void
*/
public function addContent($content)
public function addContent(string $content)
{
if ($content) {
if (!is_string($content)) {

View File

@ -8,11 +8,6 @@ class UserAuthenticated extends Event
{
public $user;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(User $user)
{
$this->user = $user;

View File

@ -8,11 +8,6 @@ class UserLoggedIn extends Event
{
public $user;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(User $user)
{
$this->user = $user;

View File

@ -9,13 +9,6 @@ class UserProfileUpdated extends Event
public $type;
public $user;
/**
* Create a new event instance.
*
* @param string $type which type of user profile was updated
*
* @return void
*/
public function __construct($type, User $user)
{
$this->type = $type;

View File

@ -8,11 +8,6 @@ class UserRegistered extends Event
{
public $user;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(User $user)
{
$this->user = $user;

View File

@ -8,14 +8,6 @@ class UserTryToLogin extends Event
public $authType;
/**
* Create a new event instance.
*
* @param string $identification email or username of the user
* @param string $authType "email" or "username"
*
* @return void
*/
public function __construct($identification, $authType)
{
$this->identification = $identification;

View File

@ -16,11 +16,6 @@ class SiteMessage extends Notification implements ShouldQueue
public $content;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct(string $title, $content = '')
{
$this->title = $title;

View File

@ -13,17 +13,12 @@ class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to your controller routes.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
/**
* Define the routes for the application.
*
* @return void
*/
public function map(Router $router)
{
@ -45,10 +40,7 @@ class RouteServiceProvider extends ServiceProvider
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes(Router $router)
{
@ -59,10 +51,7 @@ class RouteServiceProvider extends ServiceProvider
/**
* Define the "static" routes for the application.
*
* These routes will not load session, etc.
*
* @return void
*/
protected function mapStaticRoutes(Router $router)
{
@ -72,10 +61,7 @@ class RouteServiceProvider extends ServiceProvider
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
{

View File

@ -59,16 +59,9 @@ class OptionForm
}
/**
* Add option item to the form dynamically.
*
* @param string $method
* @param array $params
*
* @return OptionItem
*
* @throws \BadMethodCallException
*/
public function __call($method, $params)
public function __call(string $method, array $params): OptionFormItem
{
if (!in_array($method, ['text', 'checkbox', 'textarea', 'select', 'group'])) {
throw new BadMethodCallException("Method [$method] does not exist on option form.");
@ -88,9 +81,7 @@ class OptionForm
return $item;
}
/**
* Set the box type of option form.
*/
/** Set the box type of option form. */
public function type(string $type): self
{
$this->type = $type;
@ -98,11 +89,7 @@ class OptionForm
return $this;
}
/**
* Add a hint to option form.
*
* @param array $info
*/
/** Add a hint to option form. */
public function hint($hintContent = self::AUTO_DETECT): self
{
if ($hintContent == self::AUTO_DETECT) {
@ -131,9 +118,7 @@ class OptionForm
return $this;
}
/**
* Add a button at the footer of option form.
*/
/** Add a button at the footer of option form. */
public function addButton(array $info): self
{
$info = array_merge([

View File

@ -16,44 +16,28 @@ use Illuminate\Support\Str;
class PluginManager
{
/**
* @var bool
*/
/** @var bool */
protected $booted = false;
/**
* @var Application
*/
/** @var Application */
protected $app;
/**
* @var Option
*/
/** @var Option */
protected $option;
/**
* @var Dispatcher
*/
/** @var Dispatcher */
protected $dispatcher;
/**
* @var Filesystem
*/
/** @var Filesystem */
protected $filesystem;
/**
* @var ClassLoader
*/
/** @var ClassLoader */
protected $loader;
/**
* @var Collection|null
*/
/** @var Collection|null */
protected $plugins;
/**
* @var Collection
*/
/** @var Collection */
protected $enabled;
public function __construct(
@ -70,12 +54,7 @@ class PluginManager
$this->loader = new ClassLoader();
}
/**
* Get all installed plugins.
*
* @return Collection
*/
public function all()
public function all(): Collection
{
if (filled($this->plugins)) {
return $this->plugins;
@ -278,10 +257,7 @@ class PluginManager
});
}
/**
* @return Plugin|null
*/
public function get(string $name)
public function get(string $name): ?Plugin
{
return $this->all()->get($name);
}
@ -340,10 +316,7 @@ class PluginManager
}
}
/**
* @return Collection
*/
public function getEnabledPlugins()
public function getEnabledPlugins(): Collection
{
return $this->all()->filter(function ($plugin) {
return $plugin->isEnabled();
@ -360,9 +333,6 @@ class PluginManager
})->values()->toJson());
}
/**
* @return Collection
*/
public function getUnsatisfied(Plugin $plugin)
{
return collect(Arr::get($plugin->getManifest(), 'require', []))
@ -392,10 +362,7 @@ class PluginManager
});
}
/**
* @return Collection
*/
public function getConflicts(Plugin $plugin)
public function getConflicts(Plugin $plugin): Collection
{
return collect($plugin->getManifestAttr('enchants.conflicts', []))
->mapWithKeys(function ($constraint, $name) {
@ -441,12 +408,7 @@ class PluginManager
return array_merge($unsatisfied, $conflicts);
}
/**
* The plugins path.
*
* @return Collection
*/
public function getPluginsDirs()
public function getPluginsDirs(): Collection
{
$config = config('plugins.directory');
if ($config) {

View File

@ -5,11 +5,6 @@ use Illuminate\Database\Schema\Blueprint;
class CreateAllTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
@ -51,11 +46,6 @@ class CreateAllTables extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');

View File

@ -4,11 +4,6 @@ use Illuminate\Database\Migrations\Migration;
class ImportOptions extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// import options
@ -33,11 +28,6 @@ class ImportOptions extends Migration
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::table('options')->delete();

View File

@ -5,11 +5,6 @@ use Illuminate\Database\Schema\Blueprint;
class AddVerificationToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
@ -18,11 +13,6 @@ class AddVerificationToUsersTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {

View File

@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
class AddRememberTokenToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
@ -18,11 +13,6 @@ class AddRememberTokenToUsersTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {

View File

@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
class AddTidSkin extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('players', function (Blueprint $table) {
@ -22,11 +17,6 @@ class AddTidSkin extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('players', function (Blueprint $table) {

View File

@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
class RenamePlayersTableColumns extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('players', function (Blueprint $table) {
@ -18,11 +13,6 @@ class RenamePlayersTableColumns extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('players', function (Blueprint $table) {

View File

@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
class CreateCloset extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_closet', function (Blueprint $table) {
@ -20,11 +15,6 @@ class CreateCloset extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_closet');

View File

@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
class RemoveLikesField extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (Schema::hasColumn('textures', 'likes')) {
@ -20,13 +15,7 @@ class RemoveLikesField extends Migration
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// Do nothing.
}
}

View File

@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
class CreateNotificationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
@ -23,11 +18,6 @@ class CreateNotificationsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('notifications');

View File

@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
class CreateJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('jobs', function (Blueprint $table) {
@ -24,11 +19,6 @@ class CreateJobsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('jobs');

View File

@ -5,11 +5,6 @@ use Illuminate\Database\Schema\Blueprint;
class CreateLanguageLinesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('language_lines', function (Blueprint $table) {
@ -22,11 +17,6 @@ class CreateLanguageLinesTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('language_lines');

View File

@ -9,16 +9,9 @@ class BrowserKitTestCase extends TestCase
{
/**
* The base URL to use while testing the application.
*
* @var string
*/
protected $baseUrl = 'http://localhost';
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';

View File

@ -8,16 +8,9 @@ class TestCase extends \Illuminate\Foundation\Testing\TestCase
{
/**
* The base URL to use while testing the application.
*
* @var string
*/
protected $baseUrl = 'http://localhost';
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';