fixed:云上传配置无法生效
This commit is contained in:
75
extend/catcher/generate/build/classes/Classes.php
Normal file
75
extend/catcher/generate/build/classes/Classes.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
namespace catcher\generate\classes;
|
||||
|
||||
class Classes extends Iteration
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @time 2020年11月17日
|
||||
* @param $name
|
||||
* @return $this
|
||||
*/
|
||||
public function name($name)
|
||||
{
|
||||
$this->data['name'] = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @time 2020年11月17日
|
||||
* @param $extend
|
||||
* @return $this
|
||||
*/
|
||||
public function extend($extend)
|
||||
{
|
||||
$this->data['extend'] = $extend;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @time 2020年11月17日
|
||||
* @param $interfaces
|
||||
* @return $this
|
||||
*/
|
||||
public function interfaces($interfaces)
|
||||
{
|
||||
$this->data['interfaces'] = $interfaces;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @time 2020年11月17日
|
||||
* @return $this
|
||||
*/
|
||||
public function isAbstract()
|
||||
{
|
||||
$this->data['type'] = 'Abstract';
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @time 2020年11月17日
|
||||
* @return $this
|
||||
*/
|
||||
public function isFinal()
|
||||
{
|
||||
$this->data['type'] = 'Final';
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @time 2020年11月17日
|
||||
* @param $type
|
||||
* @param $param
|
||||
* @return void
|
||||
*/
|
||||
public function construct($type, $param)
|
||||
{
|
||||
$this->data['construct'][] = [$type, $param];
|
||||
}
|
||||
}
|
159
extend/catcher/generate/build/classes/Methods.php
Normal file
159
extend/catcher/generate/build/classes/Methods.php
Normal file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
namespace catcher\generate\classes;
|
||||
|
||||
class Methods extends Iteration
|
||||
{
|
||||
protected $method = [];
|
||||
|
||||
/**
|
||||
* set method name
|
||||
*
|
||||
* @time 2020年11月16日
|
||||
* @param string $method
|
||||
* @return $this
|
||||
*/
|
||||
public function name(string $method)
|
||||
{
|
||||
$this->method['name'] = $method;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* set visible
|
||||
*
|
||||
* @time 2020年11月16日
|
||||
* @param string $visibility
|
||||
* @return $this
|
||||
*/
|
||||
public function visible(string $visibility)
|
||||
{
|
||||
$this->method['visible'] = $visibility;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function makePublic()
|
||||
{
|
||||
$this->method['visible'] = 'public';
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function makeProtected()
|
||||
{
|
||||
$this->method['visible'] = 'protected';
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function makePrivate()
|
||||
{
|
||||
$this->method['visible'] = 'private';
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* set params
|
||||
*
|
||||
* @time 2020年11月16日
|
||||
* @param $type
|
||||
* @param $param
|
||||
* @param $default
|
||||
* @return $this
|
||||
*/
|
||||
public function param($param, $type = null, $default = null)
|
||||
{
|
||||
$this->method['params'][] = [
|
||||
'type' => $type,
|
||||
'param' => $param,
|
||||
'default' => $default,
|
||||
];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回内容
|
||||
*
|
||||
* @time 2020年11月17日
|
||||
* @param $return
|
||||
* @return $this
|
||||
*/
|
||||
public function return($return)
|
||||
{
|
||||
$this->method['return'] = $return;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回值
|
||||
*
|
||||
* @time 2020年11月16日
|
||||
* @param $return
|
||||
* @return $this
|
||||
*/
|
||||
public function returnType($return)
|
||||
{
|
||||
$this->method['return'] = $return;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 注释
|
||||
*
|
||||
* @time 2020年11月16日
|
||||
* @param $comment
|
||||
* @return $this
|
||||
*/
|
||||
public function docComment($comment)
|
||||
{
|
||||
$this->method['comment'] = $comment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 抽象
|
||||
*
|
||||
* @time 2020年11月17日
|
||||
* @return $this
|
||||
*/
|
||||
public function toAbstract()
|
||||
{
|
||||
$this->method['type'] = 'Abstract';
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* final
|
||||
*
|
||||
* @time 2020年11月17日
|
||||
* @return $this
|
||||
*/
|
||||
public function toFinal()
|
||||
{
|
||||
$this->method['type'] = 'Final';
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* join
|
||||
*
|
||||
* @time 2020年11月17日
|
||||
* @return $this
|
||||
*/
|
||||
public function join()
|
||||
{
|
||||
$this->data[] = $this->method;
|
||||
|
||||
$this->method = [];
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
97
extend/catcher/generate/build/classes/Property.php
Normal file
97
extend/catcher/generate/build/classes/Property.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
namespace catcher\generate\build\classes;
|
||||
|
||||
use PhpParser\BuilderFactory;
|
||||
|
||||
class Properties
|
||||
{
|
||||
protected $propertyBuild;
|
||||
|
||||
public function __construct(string $name)
|
||||
{
|
||||
$this->propertyBuild = (new BuilderFactory())->property($name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @time 2020年11月17日
|
||||
* @return $this
|
||||
*/
|
||||
public function public()
|
||||
{
|
||||
$this->propertyBuild->makePublic();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @time 2020年11月17日
|
||||
* @return $this
|
||||
*/
|
||||
public function protected()
|
||||
{
|
||||
$this->propertyBuild->makeProtected();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @time 2020年11月17日
|
||||
* @return $this
|
||||
*/
|
||||
public function private()
|
||||
{
|
||||
$this->propertyBuild->makePrivate();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注释
|
||||
*
|
||||
* @time 2020年11月16日
|
||||
* @param $comment
|
||||
* @return $this
|
||||
*/
|
||||
public function static($comment)
|
||||
{
|
||||
$this->propertyBuild->makeStatic();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set default
|
||||
*
|
||||
* @time 2020年11月16日
|
||||
* @param $value
|
||||
* @return $this
|
||||
*/
|
||||
public function default($value)
|
||||
{
|
||||
$this->propertyBuild->setDefault($value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function type($type)
|
||||
{
|
||||
$this->propertyBuild->setType($type);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function docComment($comment)
|
||||
{
|
||||
$this->propertyBuild->setDocComment($comment);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function build()
|
||||
{
|
||||
return $this->propertyBuild;
|
||||
}
|
||||
}
|
37
extend/catcher/generate/build/classes/Traits.php
Normal file
37
extend/catcher/generate/build/classes/Traits.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
namespace catcher\generate\classes;
|
||||
|
||||
class Traits extends Iteration
|
||||
{
|
||||
protected $trait = [];
|
||||
|
||||
public function name($name)
|
||||
{
|
||||
if (!empty($this->trait)) {
|
||||
$this->data[] = $this->trait;
|
||||
|
||||
$this->trait = [];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->trait['name'] = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function adaptation($name)
|
||||
{
|
||||
$this->trait['adaptation'] = $name;
|
||||
}
|
||||
|
||||
public function insteadof($name)
|
||||
{
|
||||
$this->trait['insteadof'] = $name;
|
||||
}
|
||||
|
||||
public function as($as)
|
||||
{
|
||||
$this->trait['as'] = $as;
|
||||
}
|
||||
}
|
23
extend/catcher/generate/build/classes/Uses.php
Normal file
23
extend/catcher/generate/build/classes/Uses.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace catcher\generate\classes;
|
||||
|
||||
use think\helper\Str;
|
||||
|
||||
class Uses extends Iteration
|
||||
{
|
||||
protected $uses;
|
||||
|
||||
public function __construct($uses)
|
||||
{
|
||||
$delimiter = ' as ';
|
||||
|
||||
foreach ($uses as $key => $use) {
|
||||
if (Str::contains($use, $delimiter)) {
|
||||
$uses[$key] = explode($delimiter, $use);
|
||||
}
|
||||
}
|
||||
|
||||
$this->data = $uses;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user