2020-11-19 09:42:54 +08:00
|
|
|
<?php
|
|
|
|
|
2020-11-19 17:31:31 +08:00
|
|
|
namespace catcher\generate\build\classes;
|
2020-11-19 09:42:54 +08:00
|
|
|
|
2020-11-19 17:31:31 +08:00
|
|
|
use PhpParser\BuilderFactory;
|
2020-11-19 09:42:54 +08:00
|
|
|
|
2020-11-19 17:31:31 +08:00
|
|
|
class Uses
|
2020-11-19 09:42:54 +08:00
|
|
|
{
|
2020-11-19 17:31:31 +08:00
|
|
|
public function name(string $name, string $as = '')
|
2020-11-19 09:42:54 +08:00
|
|
|
{
|
2020-11-19 17:31:31 +08:00
|
|
|
$build = (new BuilderFactory())->use($name);
|
2020-11-19 09:42:54 +08:00
|
|
|
|
2020-11-19 17:31:31 +08:00
|
|
|
if ($as) {
|
|
|
|
$build->as($as);
|
2020-11-19 09:42:54 +08:00
|
|
|
}
|
|
|
|
|
2020-11-19 17:31:31 +08:00
|
|
|
return $build;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function function(string $function)
|
|
|
|
{
|
|
|
|
return (new BuilderFactory())->useFunction($function);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function const(string $const)
|
|
|
|
{
|
|
|
|
return (new BuilderFactory())->useConst($const);
|
2020-11-19 09:42:54 +08:00
|
|
|
}
|
|
|
|
}
|