mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-02 03:37:44 +08:00
Added Hyperf\Rpc\PathGenerator\DotPathGenerator
. (#3626)
Co-authored-by: 李铭昕 <715557344@qq.com>
This commit is contained in:
parent
b8d504c6a4
commit
2c40ec01b7
@ -5,6 +5,10 @@
|
||||
- [#3618](https://github.com/hyperf/hyperf/pull/3618) Fixed routes with same path but different methods will be merged when using `describe:routes`.
|
||||
- [#3625](https://github.com/hyperf/hyperf/pull/3625) Fixed bug that `class_map` does not works in `Hyperf\Di\Annotation\Scanner`.
|
||||
|
||||
## Added
|
||||
|
||||
- [#3626](https://github.com/hyperf/hyperf/pull/3626) Added `Hyperf\Rpc\PathGenerator\DotPathGenerator`.
|
||||
|
||||
# v2.1.18 - 2021-05-24
|
||||
|
||||
## Fixed
|
||||
|
27
src/rpc/src/PathGenerator/DotPathGenerator.php
Normal file
27
src/rpc/src/PathGenerator/DotPathGenerator.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Rpc\PathGenerator;
|
||||
|
||||
use Hyperf\Rpc\Contract\PathGeneratorInterface;
|
||||
use Hyperf\Utils\Str;
|
||||
|
||||
class DotPathGenerator implements PathGeneratorInterface
|
||||
{
|
||||
public function generate(string $service, string $method): string
|
||||
{
|
||||
$handledNamespace = explode('\\', $service);
|
||||
$handledNamespace = Str::replaceArray('\\', ['/'], end($handledNamespace));
|
||||
$path = Str::studly($handledNamespace);
|
||||
|
||||
return $path . '.' . Str::studly($method);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user