Skip to content

🚀 New Assembler Features (DI and from<ClassName>) and Documentation #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2025

Conversation

yordadev
Copy link
Member

@yordadev yordadev commented May 14, 2025

  • Adds support for Dependency Injection to ArgonautAssembler
  • Adds from<ClassName to ArgonautAssembler
  • Adds technical doc block documentation to ArgonautDTO & ArgonautAssembler
  • Adds composer script composer coverage-html
  • Updates composer.lock
  • Updates README

New support for dependency injection usage example:

class UserDTOAssembler extends ArgonautAssembler
{
    public function __construct(protected UserFormattingService $formattingService) 
    {
        //
    }

    public static function toUserDTO(object $input): UserDTO
    {
        return new UserDTO([
            'username' => $formatingService->userName($input->display_name),
            'email' => $formatingService->email($input->email),
        ]);
    }
}

New from<ClassName> ArgonautAssembler usage example

class KeyAssembler extends ArgonautAssembler
{
    protected static function fromAccountKey(AccountKeyDTO $accountKey): KeyDTO
    {
        $from = $accountKey->is_transitioning
            ? $accountKey->from
            : [];

        return new KeyDTO(array_merge($accountKey->toArray(), [
            'type' => KeyType::ACCOUNT->label,
            'from' => $from,
        ]));
    }

    protected static function fromSigningKey(SigningKey $signingKey): KeyDTO
    {
        return new KeyDTO(array_merge($signingKey->toArray(), [
            'type' =>  KeyType::SIGNING->value,
        ]));
    }
}

Screenshot 2025-05-14 at 8 55 55 AM Screenshot 2025-05-14 at 8 56 06 AM

…tion

* Adds support for Dependency Injection to ArgonautAssembler
* Adds `from<ClassName` to ArgonautAssembler
* Adds technical doc block documentation to ArgonautDTO & ArgonautAssembler
* Adds composer script `composer coverage-html`
* Updates composer.lock
* Updates README
@yordadev yordadev self-assigned this May 14, 2025
@yordadev yordadev added documentation Improvements or additions to documentation enhancement New feature or request labels May 14, 2025
@yordadev yordadev changed the title 🚀 New Assembler Features (DI and from<ClassName>) & Package Document… 🚀 New Assembler Features (DI and from<ClassName>) and Documentation May 14, 2025
@yordadev yordadev linked an issue May 14, 2025 that may be closed by this pull request
@yordadev yordadev merged commit 9a69d75 into main May 19, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Ability to use dependencies in Assemblers
1 participant