作者 lackoxygen

feat:facade

... ... @@ -505,11 +505,11 @@ namespace Lackoxygen\TiktokShop\Facade;
use Lackoxygen\TiktokShop\Request;
use Illuminate\Support\Facades\Facade as LaravelFacade;
use Lackoxygen\TiktokShop\ServiceProvider;
use Lackoxygen\TiktokShop\Support\Verify;
use Lackoxygen\TiktokShop\Application;
\${ANNOTATE}
class Facade extends LaravelFacade
{
/**
... ... @@ -519,6 +519,15 @@ class Facade extends LaravelFacade
{
return Application::class;
}
/**
* @param string \$name
* @return mixed
*/
public static function app(string \$name): Application
{
return \app(ServiceProvider::\$name, [\$name]);
}
}
FACADE;
... ... @@ -536,8 +545,7 @@ FACADE;
array_unshift(
$metas,
' * @method static Application setAccessToken(string $accessToken)',
' * @method static Application use ($options)'
' * @method static Application accessToken(string $accessToken)',
);
$metaAnnotate = '/**' . "\n";
... ... @@ -560,7 +568,7 @@ FACADE;
$cs = $app_path . '/vendor/bin/php-cs-fixer';
if (!file_exists($cs)) {
if (!file_exists($cs) || !is_executable($cs)) {
return;
}
... ...
... ... @@ -111,7 +111,7 @@ class Application
*
* @return Application
*/
public static function use($options = null): Application
public static function app($options = null): Application
{
return new static($options);
}
... ... @@ -122,7 +122,7 @@ class Application
* @param string $accessToken
* @return Application
*/
public function setAccessToken(string $accessToken): Application
public function accessToken(string $accessToken): Application
{
$this->config->setAccessToken($accessToken);
... ...
... ... @@ -4,12 +4,12 @@ namespace Lackoxygen\TiktokShop\Facade;
use Lackoxygen\TiktokShop\Request;
use Illuminate\Support\Facades\Facade as LaravelFacade;
use Lackoxygen\TiktokShop\ServiceProvider;
use Lackoxygen\TiktokShop\Support\Verify;
use Lackoxygen\TiktokShop\Application;
/**
* @method static Application setAccessToken(string $accessToken)
* @method static Application use ($options)
* @method static Application accessToken(string $accessToken)
* @method static Verify verify()
* @method static Request\Pigeon\PigeonInterface pigeon()
* @method static Request\Sms\SmsInterface sms()
... ... @@ -35,7 +35,6 @@ use Lackoxygen\TiktokShop\Application;
* @method static Request\Material\MaterialInterface material()
* @method static Request\Address\AddressInterface address()
*/
class Facade extends LaravelFacade
{
/**
... ... @@ -45,4 +44,13 @@ class Facade extends LaravelFacade
{
return Application::class;
}
/**
* @param string $name
* @return mixed
*/
public static function app(string $name): Application
{
return \app(ServiceProvider::$name, [$name]);
}
}
... ...