class RegisterIdCommand extends Command (View source)

Register client ID in sandbox environment.

The client application ID is a user generate UUID format 4, that is then registered with MTN Momo API.

Traits

Console commands utilities.

Properties

protected ClientInterface $client

Guzzle HTTP client instance.

protected string $product

Product subscribed to.

protected string $signature

The name and signature of the console command.

protected string $description

The console command description.

Methods

bool
runInProduction(string $warning = 'Application In Production!')

Warn user running command in production.

void
printLabels(string $title, array|string $body = null)

Print formatted labels.

string
getRegex(string $name, string $key) deprecated

Determine replacement regex pattern a setting.

void
updateSetting(string $name, string $key, string $value)

Write | replace setting in .env file.

__construct(ClientInterface $client)

Create a new command instance.

void
handle()

Execute the console command.

string
getClientId()

Determine client ID.

string
getClientRedirectUri()

Determine client redirect URI.

bool
registerClientId(string $clientId, string $clientRedirectUri)

Register client ID.

Details

protected bool runInProduction(string $warning = 'Application In Production!')

Warn user running command in production.

Parameters

string $warning

Return Value

bool

protected void printLabels(string $title, array|string $body = null)

Print formatted labels.

Parameters

string $title
array|string $body

Return Value

void

protected string getRegex(string $name, string $key) deprecated

deprecated 1.3 No longer used.

Determine replacement regex pattern a setting.

Parameters

string $name

ENV_VALUE, like; APP_NAME

string $key

Compose setting name, like app.name

Return Value

string

Regex pattern

protected void updateSetting(string $name, string $key, string $value)

Write | replace setting in .env file.

Parameters

string $name

ENV_VALUE, like; APP_NAME

string $key

Compose setting name, like app.name

string $value

Setting value

Return Value

void

__construct(ClientInterface $client)

Create a new command instance.

Parameters

ClientInterface $client

void handle()

Execute the console command.

Return Value

void

Exceptions

GuzzleException

protected string getClientId()

Determine client ID.

Return Value

string

Exceptions

Exception

protected string getClientRedirectUri()

Determine client redirect URI.

Return Value

string

protected bool registerClientId(string $clientId, string $clientRedirectUri)

Register client ID.

The redirect URI is implemented in sandbox environment, but is still required when registering a client ID.

Parameters

string $clientId
string $clientRedirectUri

Return Value

bool

Is registered.

Exceptions

GuzzleException