Webiny\Component\Rest\Parser\PathTransformations::methodNameToUrl PHP Method

methodNameToUrl() public static method

Transforms method name to a url path.
public static methodNameToUrl ( string $methodName ) : string
$methodName string Method name.
return string
    public static function methodNameToUrl($methodName)
    {
        $url = preg_replace('/([A-Z])/', ' $1', $methodName);
        $url = self::str($url)->trim()->replace(' ', '-')->caseLower()->val();
        return $url;
    }

Usage Example

 /**
  * @dataProvider methodNameToUrlProvider
  *
  * @param $method
  * @param $expected
  */
 public function testMethodNameToUrl($method, $expected)
 {
     $this->assertSame($expected, PathTransformations::methodNameToUrl($method));
 }
All Usage Examples Of Webiny\Component\Rest\Parser\PathTransformations::methodNameToUrl