パラメータを強固にする

<?php

trait EXParaBoxLogic
{
	public function isNewBox(): bool
	{
		return is_null( $this->boxId );
	}

	public function isEditBox(): bool
	{
		return ! $this->isNewBox();
	}

	public function isBoxOwner( ?int $checkUsercd = null ): bool
	{
		if ( $this->isEditBox() )
		{
			$usercd = $checkUsercd ?? wg_get_usercd();

			return _QQ( 'SELECT * FROM owner WHERE id = %s AND usercd = %s', _N( $this->boxId ), _N( $usercd ) ) !== false;
		}
		else
		{
			return false;
		}
	}

	public function isExistsBox(): bool
	{
		return _QQ( 'SELECT * FROM boxconfig WHERE id = %s;', _N( $this->boxId ) ) !== false;
	}

	public function getBox(bool $isGetAutomatically = false): WGMModel
	{
		$model = new WGMModel( 'boxconfig' );
		if( $isGetAutomatically ) $model->getVars( [ 'id' => $this->boxId ] );

		return $model;
	}
}

trait EXParaBoxId
{
	use EXParaBoxLogic;

	#[WGPara( name: 'bi', gauntlet: new WGGInt(), default: null )]
	public ?int $boxId = null;
}

trait EXParaBoxIdAllowNULL
{
	use EXParaDocLogic;

	#[WGPara( name: 'bi', gauntlet: new HKGIntAllowNULL(), default: null )]
	public ?int $boxId = null;
}