protected function checkMigrations(array $migrations, string $method, string $targetVersion): bool
	{
		// Check if no migrations found
		if (empty($migrations))
		{
			if ($this->silent)
			{
				return false;
			}
			throw new \RuntimeException(lang('Migrations.empty'));
		}

		// Check if $targetVersion file is found
		if ((int)$targetVersion !== 0 && ! array_key_exists($targetVersion, $migrations))
		{
			if ($this->silent)
			{
				return false;
			}
			throw new \RuntimeException(lang('Migrations.notFound') . $targetVersion);
		}

		ksort($migrations);

		if ($method === 'down')
		{
			$history_migrations = $this->getHistory($this->group);
			$history_size       = count($history_migrations) - 1;
		}
		// Check for sequence gaps
		$loop = 0;
		foreach ($migrations as $migration)
		{
			if ($this->type === 'sequential' && abs($migration->version - $loop) > 1)
			{
				throw new \RuntimeException(lang('Migrations.gap') . ' ' . $migration->version);
			}
			// Check if all old migration files are all available to do downgrading
			if ($method === 'down')
			{
				if ($loop <= $history_size && $history_migrations[$loop]['version'] !== $migration->version)
				{
					throw new \RuntimeException(lang('Migrations.gap') . ' ' . $migration->version);
				}
			}
			$loop ++;
		}

		return true;
	}
protected function checkMigrations(array $migrations, string $method, string $targetVersion): bool
	{
		// Check if no migrations found
		if (empty($migrations))
		{
			if ($this->silent)
			{
				return false;
			}
			throw new \RuntimeException(lang('Migrations.empty'));
		}

		// Check if $targetVersion file is found
		if ((int)$targetVersion !== 0 && ! array_key_exists($targetVersion, $migrations))
		{
			if ($this->silent)
			{
				return false;
			}
			throw new \RuntimeException(lang('Migrations.notFound') . $targetVersion);
		}

		ksort($migrations);

		if ($method === 'down')
		{
			$history_migrations = $this->getHistory($this->group);
			$history_size       = count($history_migrations) - 1;
		}
		// Check for sequence gaps
		$loop = 0;
		foreach ($migrations as $migration)
		{
			if ($this->type === 'sequential' && abs($migration->version - $loop) > 1)
			{
				throw new \RuntimeException(lang('Migrations.gap') . ' ' . $migration->version);
			}
			// Check if all old migration files are all available to do downgrading
			if ($method === 'down')
			{
				if ($loop <= $history_size && $history_migrations[$loop]['version'] !== $migration->version)
				{
					throw new \RuntimeException(lang('Migrations.gap') . ' ' . $migration->version);
				}
			}
			$loop ++;
		}

		return true;
	}
protected function checkMigrations ( array $ migrations , string $ method , string $ targetVersion ) : bool { // Check if no migrations found if ( empty ( $ migrations ) ) { if ( $ this -> silent ) { return false ; } throw new \ RuntimeException ( lang ( 'Migrations.empty' ) ) ; } // Check if $targetVersion file is found if ( ( int ) $ targetVersion !== 0 && ! array_key_exists ( $ targetVersion , $ migrations ) ) { if ( $ this -> silent ) { return false ; } throw new \ RuntimeException ( lang ( 'Migrations.notFound' ) . $ targetVersion ) ; } ksort ( $ migrations ) ; if ( $ method === 'down' ) { $ history_migrations = $ this -> getHistory ( $ this -> group ) ; $ history_size = count ( $ history_migrations ) - 1 ; } // Check for sequence gaps $ loop = 0 ; foreach ( $ migrations as $ migration ) { if ( $ this -> type === 'sequential' && abs ( $ migration -> version - $ loop ) > 1 ) { throw new \ RuntimeException ( lang ( 'Migrations.gap' ) . ' ' . $ migration -> version ) ; } // Check if all old migration files are all available to do downgrading if ( $ method === 'down' ) { if ( $ loop <= $ history_size && $ history_migrations [ $ loop ] [ 'version' ] !== $ migration -> version ) { throw new \ RuntimeException ( lang ( 'Migrations.gap' ) . ' ' . $ migration -> version ) ; } } $ loop ++ ; } return true ; }
checks if the list of available migration scripts list are consistent
if sequential check if no gaps and check if all consistent with migrations table if downgrading
if timestamp check if consistent with migrations table if downgrading

@param array  $migrations
@param string $method
@param string $targetVersion

@return boolean
checks if the list of available migration scripts list are consistent if sequential check if no gaps and check if all consistent with migrations table if downgrading if timestamp check if consistent with migrations table if downgrading