Added Hyperf\Rpc\PathGenerator\DotPathGenerator. (#3626)

Co-authored-by: 李铭昕 <715557344@qq.com>
This commit is contained in:
黄朝晖 2021-05-30 12:51:48 +08:00 committed by GitHub
parent b8d504c6a4
commit 2c40ec01b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 0 deletions

View File

@ -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

View 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);
}
}