eee
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace wchat\common;
|
||||
|
||||
use JetBrains\PhpStorm\ArrayShape;
|
||||
|
||||
class AppConfig
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected string $appId = '';
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected string $appSecret = '';
|
||||
|
||||
|
||||
/**
|
||||
* @var PayConfig
|
||||
*/
|
||||
protected PayConfig $payConfig;
|
||||
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected int $type;
|
||||
|
||||
|
||||
/**
|
||||
* @var array|string[]
|
||||
*/
|
||||
#[ArrayShape(['token' => 'string', 'secret' => 'string', 'unionId' => 'string'])]
|
||||
protected array $notice = ['token' => '', 'secret' => '', 'unionId' => ''];
|
||||
|
||||
|
||||
/**
|
||||
* @param object $app
|
||||
* @return static
|
||||
*/
|
||||
public static function instance(object $app): static
|
||||
{
|
||||
$model = new static();
|
||||
$model->appId = $app->appId;
|
||||
$model->appSecret = $app->appSecret;
|
||||
$model->type = $app->type;
|
||||
$model->payConfig = PayConfig::parse($app->pay);
|
||||
return $model;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function typeIsApp(): bool
|
||||
{
|
||||
return $this->type === 3;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user