Created
February 5, 2019 14:51
-
-
Save spudro228/ce43f6425c99e07635f2dff2d9236e69 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
$code = <<<'CODE' | |
protected $baseUrl = '/api/countries'; | |
$client->request('GET', $this->baseUrl . "kek"); | |
$client->request('GET', $this->baseUrl.'kek'); | |
CODE; | |
$re = '/((protected|public)\s+\$baseUrl\s+=\s+\'(?<url>[\/\w+]+)\')/m'; | |
preg_match_all($re, $code, $matches, PREG_SET_ORDER); | |
// \vardump() | |
$url = $matches[0]['url']; | |
echo preg_replace('/(\$this->baseUrl)/m', $url , $code); | |
// echo $code; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment