known icon indicating copy to clipboard operation
known copied to clipboard

Simplify Idno core and common namespaces

Open benwerd opened this issue 4 months ago • 1 comments

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 method normalizeUrlForToken and reused it in generateToken to deduplicate code.

Here's why I did it:

The primary goal was to simplify and clarify code within the Idno\Core and Idno\Common namespaces, as requested. This refactoring addresses areas of complexity, reduces redundant logic, improves readability, and fixes a minor bug in Page::getInput, making the codebase more maintainable and easier to understand.

Checklist: ([x] to check/tick the boxes)

  • [x] This pull request addresses a single issue
  • [ ] If this code includes interface changes, I've included screenshots in this Pull Request thread
  • [x] I've adhered to Known's style guide (these codesniffer rules might help!)
  • [ ] My git branch is named in a descriptive way - i.e., yourname-summary-of-issue
  • [ ] I've tested my code in-browser
  • [x] My code contains descriptive comments
  • [ ] I've added tests where applicable, and...
  • [ ] I can run the unit tests successfully.

Open in Cursor Open in Web

benwerd avatar Sep 06 '25 21:09 benwerd

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch. Learn more about Cursor Agents

cursor[bot] avatar Sep 06 '25 21:09 cursor[bot]