-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize php call proxy command, and add php-cs-fixer proxy command
Signed-off-by: huangzhhui <[email protected]>
- Loading branch information
1 parent
52b489e
commit ccc6c7f
Showing
5 changed files
with
100 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of Hyperf. | ||
* | ||
* @link https://www.hyperf.io | ||
* @document https://hyperf.wiki | ||
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
namespace App\Command; | ||
|
||
use Hyperf\Utils\Str; | ||
|
||
abstract class AbstractPhpCallProxyCommand extends AbstractCommand | ||
{ | ||
protected string $proxyCommand; | ||
|
||
protected string $proxyBin; | ||
|
||
public function configure() | ||
{ | ||
$this->setDescription(sprintf('The proxy command of `php %s`.', $this->proxyCommand)); | ||
$this->setName($this->proxyCommand); | ||
$this->ignoreValidationErrors(); | ||
} | ||
|
||
public function handle() | ||
{ | ||
$bin = $this->buildBinCommand(); | ||
$command = Str::replaceFirst($this->proxyCommand . ' ', '', (string) $this->input); | ||
$fullCommand = sprintf('%s %s', $bin, $command); | ||
var_dump($fullCommand); | ||
$this->liveCommand($fullCommand); | ||
} | ||
|
||
protected function buildBinCommand(): string | ||
{ | ||
$path = $this->getRuntimePath(); | ||
return $path . '/php' . $this->getCurrentPhpVersion() . ' ' . $path . '/' . $this->proxyBin; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of Hyperf. | ||
* | ||
* @link https://www.hyperf.io | ||
* @document https://hyperf.wiki | ||
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
namespace App\Command; | ||
|
||
use Hyperf\Command\Annotation\Command; | ||
|
||
#[Command] | ||
class ComposerProxyCommand extends AbstractPhpCallProxyCommand | ||
{ | ||
protected string $proxyCommand = 'composer'; | ||
|
||
protected string $proxyBin = 'composer.phar'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of Hyperf. | ||
* | ||
* @link https://www.hyperf.io | ||
* @document https://hyperf.wiki | ||
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
namespace App\Command; | ||
|
||
use Hyperf\Command\Annotation\Command; | ||
|
||
#[Command] | ||
class PhpCsFixerProxyCommand extends AbstractPhpCallProxyCommand | ||
{ | ||
protected string $proxyCommand = 'php-cs-fixer'; | ||
|
||
protected string $proxyBin = 'php-cs-fixer.phar'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters