Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6dfff1c
add size method
walmir-silva Jul 1, 2024
18284e0
feat: Normalize Interfaces
walmir-silva Jul 1, 2024
21fc7c0
Merge branch 'main' into develop
walmir-silva Jul 1, 2024
132e0ee
Refactor and Normalize Collection Interface and Implementation
walmir-silva Jul 1, 2024
1124a8a
Merge branch 'main' into develop
walmir-silva Jul 1, 2024
f40b0c3
feat: Add BinaryHeap implementation and comprehensive tests
walmir-silva Jul 2, 2024
aaeb8d9
docs: Update README files in English and Portuguese
walmir-silva Jul 2, 2024
b1d7662
style: Normalize code formatting and style
walmir-silva Jul 2, 2024
d677ae5
Merge branch 'main' into develop
walmir-silva Jul 2, 2024
ff2922f
feat: Create Container interface and add unit tests
walmir-silva Jul 5, 2024
8316540
feat: Add logging interfaces and corresponding tests
walmir-silva Jul 5, 2024
fd0cb1c
feat: Update logging interfaces Add tests for LoggerAware and LoggerC…
walmir-silva Jul 10, 2024
1b46d44
Merge branch 'main' into develop
walmir-silva Jul 10, 2024
30dd462
feat(logging): improve log rotation and update log handler
walmir-silva Jul 18, 2024
fc2bbe3
Refactor:Indexable interface and LogLevel class
walmir-silva Oct 10, 2024
c00bfdc
Merge branch 'main' into develop
walmir-silva Oct 10, 2024
788e773
feat(contract): Add Processor interfaces and tests
walmir-silva Oct 13, 2024
b40023f
feat: add ProcessorRegistry interface and unit tests
walmir-silva Oct 13, 2024
468dc9a
Merge branch 'main' into develop
walmir-silva Oct 13, 2024
9e223a4
feat(processor): add ProcessorBuilder interface and test suite
walmir-silva Oct 14, 2024
3da44b1
Merge branch 'develop' of https://github.com/KaririCode-Framework/kar…
walmir-silva Oct 14, 2024
611e84f
feat(contract): add PHPDoc for ProcessableAttribute interface and cre…
walmir-silva Oct 15, 2024
185bd7c
Merge branch 'main' into develop
walmir-silva Oct 15, 2024
bf99f58
feat(contract): add Sanitizer, Serializer, and Validator interfaces w…
walmir-silva Oct 15, 2024
3e56162
Merge branch 'develop' of https://github.com/KaririCode-Framework/kar…
walmir-silva Oct 15, 2024
b1a9521
fix(validator): correct return type of Validator interface
walmir-silva Oct 15, 2024
115cad9
Merge branch 'main' into develop
walmir-silva Oct 15, 2024
2fcec44
feat(contract): add CustomizableMessageAttribute interface
walmir-silva Oct 18, 2024
c6758d7
Merge branch 'develop' of https://github.com/KaririCode-Framework/kar…
walmir-silva Oct 18, 2024
1cbe3ca
feat: add BaseProcessorAttribute abstract class
walmir-silva Oct 18, 2024
756ea9f
refactor: adjusty filterValidProcessors in BaseProcessorAttribute
walmir-silva Oct 18, 2024
bf508f4
Merge branch 'main' into develop
walmir-silva Oct 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 5 additions & 16 deletions src/Processor/Attribute/BaseProcessorAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

abstract class BaseProcessorAttribute implements ProcessableAttribute, CustomizableMessageAttribute
{
protected array $processors;
protected array $messages;
private readonly array $processors;
private readonly array $messages;

public function __construct(array $processors, ?array $messages = null)
{
$this->processors = $this->normalizeProcessors($processors);
$this->processors = self::filterValidProcessors($processors);
$this->messages = $messages ?? [];
}

Expand All @@ -25,19 +25,8 @@ public function getMessage(string $processorName): ?string
return $this->messages[$processorName] ?? null;
}

protected function normalizeProcessors(array $processors): array
private static function filterValidProcessors(array $processors): array
{
$normalized = [];
foreach ($processors as $key => $value) {
if (is_int($key)) {
$normalized[$value] = [];
} elseif (is_string($value)) {
$normalized[$key] = [];
} else {
$normalized[$key] = $value;
}
}

return $normalized;
return array_filter($processors, static fn ($v) => null !== $v && false !== $v);
}
}
Loading