作者 lackoxygen

feat:facade

@@ -505,11 +505,11 @@ namespace Lackoxygen\TiktokShop\Facade; @@ -505,11 +505,11 @@ namespace Lackoxygen\TiktokShop\Facade;
505 505
506 use Lackoxygen\TiktokShop\Request; 506 use Lackoxygen\TiktokShop\Request;
507 use Illuminate\Support\Facades\Facade as LaravelFacade; 507 use Illuminate\Support\Facades\Facade as LaravelFacade;
  508 +use Lackoxygen\TiktokShop\ServiceProvider;
508 use Lackoxygen\TiktokShop\Support\Verify; 509 use Lackoxygen\TiktokShop\Support\Verify;
509 use Lackoxygen\TiktokShop\Application; 510 use Lackoxygen\TiktokShop\Application;
510 511
511 \${ANNOTATE} 512 \${ANNOTATE}
512 -  
513 class Facade extends LaravelFacade 513 class Facade extends LaravelFacade
514 { 514 {
515 /** 515 /**
@@ -519,6 +519,15 @@ class Facade extends LaravelFacade @@ -519,6 +519,15 @@ class Facade extends LaravelFacade
519 { 519 {
520 return Application::class; 520 return Application::class;
521 } 521 }
  522 +
  523 + /**
  524 + * @param string \$name
  525 + * @return mixed
  526 + */
  527 + public static function app(string \$name): Application
  528 + {
  529 + return \app(ServiceProvider::\$name, [\$name]);
  530 + }
522 } 531 }
523 FACADE; 532 FACADE;
524 533
@@ -536,8 +545,7 @@ FACADE; @@ -536,8 +545,7 @@ FACADE;
536 545
537 array_unshift( 546 array_unshift(
538 $metas, 547 $metas,
539 - ' * @method static Application setAccessToken(string $accessToken)',  
540 - ' * @method static Application use ($options)' 548 + ' * @method static Application accessToken(string $accessToken)',
541 ); 549 );
542 550
543 $metaAnnotate = '/**' . "\n"; 551 $metaAnnotate = '/**' . "\n";
@@ -560,7 +568,7 @@ FACADE; @@ -560,7 +568,7 @@ FACADE;
560 568
561 $cs = $app_path . '/vendor/bin/php-cs-fixer'; 569 $cs = $app_path . '/vendor/bin/php-cs-fixer';
562 570
563 - if (!file_exists($cs)) { 571 + if (!file_exists($cs) || !is_executable($cs)) {
564 return; 572 return;
565 } 573 }
566 574
@@ -111,7 +111,7 @@ class Application @@ -111,7 +111,7 @@ class Application
111 * 111 *
112 * @return Application 112 * @return Application
113 */ 113 */
114 - public static function use($options = null): Application 114 + public static function app($options = null): Application
115 { 115 {
116 return new static($options); 116 return new static($options);
117 } 117 }
@@ -122,7 +122,7 @@ class Application @@ -122,7 +122,7 @@ class Application
122 * @param string $accessToken 122 * @param string $accessToken
123 * @return Application 123 * @return Application
124 */ 124 */
125 - public function setAccessToken(string $accessToken): Application 125 + public function accessToken(string $accessToken): Application
126 { 126 {
127 $this->config->setAccessToken($accessToken); 127 $this->config->setAccessToken($accessToken);
128 128
@@ -4,12 +4,12 @@ namespace Lackoxygen\TiktokShop\Facade; @@ -4,12 +4,12 @@ namespace Lackoxygen\TiktokShop\Facade;
4 4
5 use Lackoxygen\TiktokShop\Request; 5 use Lackoxygen\TiktokShop\Request;
6 use Illuminate\Support\Facades\Facade as LaravelFacade; 6 use Illuminate\Support\Facades\Facade as LaravelFacade;
  7 +use Lackoxygen\TiktokShop\ServiceProvider;
7 use Lackoxygen\TiktokShop\Support\Verify; 8 use Lackoxygen\TiktokShop\Support\Verify;
8 use Lackoxygen\TiktokShop\Application; 9 use Lackoxygen\TiktokShop\Application;
9 10
10 /** 11 /**
11 - * @method static Application setAccessToken(string $accessToken)  
12 - * @method static Application use ($options) 12 + * @method static Application accessToken(string $accessToken)
13 * @method static Verify verify() 13 * @method static Verify verify()
14 * @method static Request\Pigeon\PigeonInterface pigeon() 14 * @method static Request\Pigeon\PigeonInterface pigeon()
15 * @method static Request\Sms\SmsInterface sms() 15 * @method static Request\Sms\SmsInterface sms()
@@ -35,7 +35,6 @@ use Lackoxygen\TiktokShop\Application; @@ -35,7 +35,6 @@ use Lackoxygen\TiktokShop\Application;
35 * @method static Request\Material\MaterialInterface material() 35 * @method static Request\Material\MaterialInterface material()
36 * @method static Request\Address\AddressInterface address() 36 * @method static Request\Address\AddressInterface address()
37 */ 37 */
38 -  
39 class Facade extends LaravelFacade 38 class Facade extends LaravelFacade
40 { 39 {
41 /** 40 /**
@@ -45,4 +44,13 @@ class Facade extends LaravelFacade @@ -45,4 +44,13 @@ class Facade extends LaravelFacade
45 { 44 {
46 return Application::class; 45 return Application::class;
47 } 46 }
  47 +
  48 + /**
  49 + * @param string $name
  50 + * @return mixed
  51 + */
  52 + public static function app(string $name): Application
  53 + {
  54 + return \app(ServiceProvider::$name, [$name]);
  55 + }
48 } 56 }