const instance = new Lol();
instance.extend((inst: Lol) => {
inst.customProp = 'lol';
inst.myMethod1(123123);
});
import BaseLol from "base-lol";
class Lol extends BaseLol {
constructor(public name: string) {
super();
this.name = name.toUpperCase();
}
}
export default BaseLol.exportCallable(Lol)
export default Lol.exportCallable
class Lol extends BaseLol {
constructor(public name: string) {
super();
this.name = name.toUpperCase();
}
}
export default Lol.exportCallable
class Lol extends BaseLol {
prop; <<<< вот этот ?
init(prop) {
console.log(prop); //qwe
this.prop = prop;
}
}
function replaceDefaults($str, $params)
{
preg_match_all('~{(.+?):(.*?)}~', $str, $defaults, PREG_SET_ORDER);
foreach ($defaults as [$from, $key, $to]) {
if (key_exists($key, $params)) {
$str = str_replace($from, "{{$key}}", $str);
} else {
$str = str_replace($from, $to, $str);
}
}
return $str;
}
function replaceParams($str, $params): array
{
$result = [];
if (count($params)) {
$key = key($params);
$values = (array)$params[$key];
unset($params[$key]);
foreach ($values as $val) {
array_push($result, ...replaceParams(str_replace("{{$key}}", $val, $str), $params));
}
} else {
$result[] = $str;
}
return $result;
}
function generator($str, $params)
{
$str = replaceDefaults($str, $params);
return replaceParams($str, $params);
}
$values = is_array($params[$key]) ? $params[$key] : [ $params[$key] ];
$values = (array)$params[$key];
Route::prefix('группа1')->group(function () {
Route::mymethod(' начнём {dynamicparam:\d+} закончим{optionalparam:\d+}?', function (PayloadInterface $payload, $dynamicparam, $optionalparam) {
// Matches The "группа1 начнём 1234 закончим"
return $result;
})->middleware($qwe2);
Route::all('и тд..', function () {
});
})->middleware($qwe1);
Всё разобрался)))