Simplify Idno core and common namespaces #3314
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here's what I fixed or added:
Idno\Common\Page::getInput: Refactored input retrieval logic to clarify precedence (request > JSON payload > default) and ensure filters are applied correctly, fixing a minor bug.Idno\Core\Idno::componentFactory: Simplified the factory method to reduce branching, consolidate class existence and subclass validation, and handle default class instantiation more consistently.Idno\Core\Config: Streamlined several boolean and string return helpers (getTitle,getDescription,isPublicSite,multipleSyndicationAccounts,isDefaultConfig) using null coalescing and direct boolean casts.Idno\Core\Service: Extracted URL normalization logic into a new private helper methodnormalizeUrlForTokenand reused it ingenerateTokento deduplicate code.Here's why I did it:
The primary goal was to simplify and clarify code within the
Idno\CoreandIdno\Commonnamespaces, as requested. This refactoring addresses areas of complexity, reduces redundant logic, improves readability, and fixes a minor bug inPage::getInput, making the codebase more maintainable and easier to understand.Checklist: (
[x]to check/tick the boxes)