Enhance refactor commands with controller-aware Route() updates and fix code quality violations
Add semantic token highlighting for 'that' variable and comment file references in VS Code extension Add Phone_Text_Input and Currency_Input components with formatting utilities Implement client widgets, form standardization, and soft delete functionality Add modal scroll lock and update documentation Implement comprehensive modal system with form integration and validation Fix modal component instantiation using jQuery plugin API Implement modal system with responsive sizing, queuing, and validation support Implement form submission with validation, error handling, and loading states Implement country/state selectors with dynamic data loading and Bootstrap styling Revert Rsx::Route() highlighting in Blade/PHP files Target specific PHP scopes for Rsx::Route() highlighting in Blade Expand injection selector for Rsx::Route() highlighting Add custom syntax highlighting for Rsx::Route() and Rsx.Route() calls Update jqhtml packages to v2.2.165 Add bundle path validation for common mistakes (development mode only) Create Ajax_Select_Input widget and Rsx_Reference_Data controller Create Country_Select_Input widget with default country support Initialize Tom Select on Select_Input widgets Add Tom Select bundle for enhanced select dropdowns Implement ISO 3166 geographic data system for country/region selection Implement widget-based form system with disabled state support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
128
vendor/sokil/php-isocodes/src/AbstractNotPartitionedDatabase.php
vendored
Normal file
128
vendor/sokil/php-isocodes/src/AbstractNotPartitionedDatabase.php
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sokil\IsoCodes;
|
||||
|
||||
/**
|
||||
* Abstract collection of ISO entries loaded from single file
|
||||
*/
|
||||
abstract class AbstractNotPartitionedDatabase extends AbstractDatabase
|
||||
{
|
||||
/**
|
||||
* Index to search by entry field's values
|
||||
*
|
||||
* {indexedFieldName => {indexedFieldValue => entryObject}}
|
||||
*
|
||||
* @psalm-var Array<string, Array<string, object>>
|
||||
* @var object[][]
|
||||
*/
|
||||
private $index;
|
||||
|
||||
/**
|
||||
* List of entry fields to be indexed and searched.
|
||||
* May be override in child classes to search by indexed fields.
|
||||
*
|
||||
* @return mixed[]
|
||||
*/
|
||||
protected function getIndexDefinition(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function buildIndex(): void
|
||||
{
|
||||
// init empty index
|
||||
$this->index = [];
|
||||
|
||||
// get index definition
|
||||
$indexedFields = $this->getIndexDefinition();
|
||||
|
||||
// build index for database
|
||||
if (!empty($indexedFields)) {
|
||||
// init all defined indexes
|
||||
foreach ($this->getClusterIndex() as $entryArray) {
|
||||
$entry = $this->arrayToEntry($entryArray);
|
||||
foreach ($indexedFields as $indexName => $indexDefinition) {
|
||||
if (is_array($indexDefinition)) {
|
||||
// compound index
|
||||
// iteratively create hierarchy of array indexes
|
||||
$reference = &$this->index[$indexName];
|
||||
foreach ($indexDefinition as $indexDefinitionPart) {
|
||||
if (is_array($indexDefinitionPart)) {
|
||||
// limited length of field
|
||||
$indexDefinitionPartValue = substr(
|
||||
$entryArray[$indexDefinitionPart[0]],
|
||||
0,
|
||||
$indexDefinitionPart[1]
|
||||
);
|
||||
} else {
|
||||
$indexDefinitionPartValue = $entryArray[$indexDefinitionPart];
|
||||
}
|
||||
|
||||
if (!isset($reference[$indexDefinitionPartValue])) {
|
||||
$reference[$indexDefinitionPartValue] = [];
|
||||
}
|
||||
|
||||
$reference = &$reference[$indexDefinitionPartValue];
|
||||
}
|
||||
|
||||
// add value
|
||||
$reference = $entry;
|
||||
} else {
|
||||
// single index
|
||||
$indexName = $indexDefinition;
|
||||
|
||||
// skip empty field
|
||||
if (empty($entryArray[$indexDefinition])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// add to indexUA
|
||||
$this->index[$indexName][$entryArray[$indexDefinition]] = $entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed[]
|
||||
*
|
||||
* @throws \InvalidArgumentException If no index found in database
|
||||
*/
|
||||
private function getIndex(string $indexedFieldName): array
|
||||
{
|
||||
// build index
|
||||
if ($this->index === null) {
|
||||
$this->buildIndex();
|
||||
}
|
||||
|
||||
// get index
|
||||
if (!isset($this->index[$indexedFieldName])) {
|
||||
throw new \InvalidArgumentException(
|
||||
sprintf(
|
||||
'Unknown index "%s" in database "%s"',
|
||||
$indexedFieldName,
|
||||
get_class()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $this->index[$indexedFieldName];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $indexedFieldName
|
||||
* @param string $fieldValue
|
||||
*
|
||||
* @return null|object|object[] null when not found, object when found by single-field index,
|
||||
* object[] when found by compound index
|
||||
*/
|
||||
protected function find(string $indexedFieldName, string $fieldValue)
|
||||
{
|
||||
$fieldIndex = $this->getIndex($indexedFieldName);
|
||||
|
||||
return $fieldIndex[$fieldValue] ?? null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user