Skip to content
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

Facade resolving for callStatic #1481

Open
fredattack opened this issue Nov 10, 2023 · 0 comments
Open

Facade resolving for callStatic #1481

fredattack opened this issue Nov 10, 2023 · 0 comments
Labels

Comments

@fredattack
Copy link

Versions:

  • ide-helper Version: 2.13.0
  • Laravel Version: 9.16
  • PHP Version: 8.2

Question:

Hi,

How can I generate helpers for this kind of using, is there any way to do this? :

<?php

namespace App\Facades\Models;

use App\Services\IdentityManagerService;

class IdentityManager
{
    public static function __callStatic(string $name, array $arguments)
    {
        return self::resolve($name, $arguments);
    }

    private static function resolve(string $name, array $arguments)
    {
        return (app()->make(IdentityManagerService::class))->$name(...$arguments);
    }
}

wich resolve this class:

<?php

namespace App\Services;



class IdentityManagerService
{
    public const UNRAW_KEYS = ['account_id', 'parent_id', 'is_imported', 'hash', 'duplicate_ignore', 'bulk_identity_id'];

    /**
     * Create first parent identity and link at default identity on User
     *
     * @param array $newIdentity
     * @return Identity
     */
    public function createFirstIdentity(User $user, array $newIdentity): Identity
    {
       ...
    }
}

and is use like that:

$identity = IdentityManager::createChild(
                        parent:$parentIdentity,
                        newIdentity: $identityData,
                        account: Account::find(26)
                    );

How can i map my facade "IdentityManager" to my Service "IdentityManagerSerice"

Thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant