This commit is contained in:
wangjinlei
2022-04-06 18:02:49 +08:00
parent e34f87de36
commit c1885928ff
262 changed files with 18633 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
<?php
namespace hg\apidoc\annotation;
use Doctrine\Common\Annotations\Annotation;
/**
* 添加模型的字段
* @package hg\apidoc\annotation
* @Annotation
* @Target({"METHOD"})
*/
class AddField extends Annotation
{
/**
* 字段名
* @var string
*/
public $name;
/**
* 类型
* @var string
*/
public $type = 'string';
/**
* 默认值
* @var string
*/
public $default;
/**
* 描述
* @var string
*/
public $desc;
/**
* 必须
* @var bool
*/
public $require = false;
}

View File

@@ -0,0 +1,14 @@
<?php
namespace hg\apidoc\annotation;
use Doctrine\Common\Annotations\Annotation;
/**
* 作者
* @package hg\apidoc\annotation
* @Annotation
* @Target({"METHOD"})
*/
class Author extends Annotation
{}

View File

@@ -0,0 +1,14 @@
<?php
namespace hg\apidoc\annotation;
use Doctrine\Common\Annotations\Annotation;
/**
* 描述
* @package hg\apidoc\annotation
* @Annotation
* @Target({"METHOD","CLASS"})
*/
class Desc extends Annotation
{}

View File

@@ -0,0 +1,14 @@
<?php
namespace hg\apidoc\annotation;
use Doctrine\Common\Annotations\Annotation;
/**
* 指定获取模型的字段
* @package hg\apidoc\annotation
* @Annotation
* @Target({"METHOD"})
*/
class Field extends Annotation
{}

View File

@@ -0,0 +1,14 @@
<?php
namespace hg\apidoc\annotation;
use Doctrine\Common\Annotations\Annotation;
/**
* 分组
* @package hg\apidoc\annotation
* @Annotation
* @Target({"CLASS"})
*/
class Group extends Annotation
{}

View File

@@ -0,0 +1,40 @@
<?php
namespace hg\apidoc\annotation;
/**
* 请求头
* @package hg\apidoc\annotation
* @Annotation
* @Target({"METHOD"})
*/
class Header extends ParamBase
{
/**
* 必须
* @var bool
*/
public $require = false;
/**
* 类型
* @var string
*/
public $type;
/**
* 引入
* @var string
*/
public $ref;
/**
* 描述
* @var string
*/
public $desc;
}

View File

@@ -0,0 +1,14 @@
<?php
namespace hg\apidoc\annotation;
use Doctrine\Common\Annotations\Annotation;
/**
* Url
* @package hg\apidoc\annotation
* @Annotation
* @Target({"METHOD"})
*/
class Method extends Annotation
{}

View File

@@ -0,0 +1,27 @@
<?php
namespace hg\apidoc\annotation;
/**
* 请求参数
* @package hg\apidoc\annotation
* @Annotation
* @Target({"METHOD","ANNOTATION"})
*/
final class Param extends ParamBase
{
/**
* 必须
* @var bool
*/
public $require = false;
/**
* 引入
* @var string
*/
public $ref;
}

View File

@@ -0,0 +1,62 @@
<?php
namespace hg\apidoc\annotation;
use Doctrine\Common\Annotations\Annotation;
abstract class ParamBase extends Annotation
{
/**
* 类型
* @Enum({"string", "integer", "int", "boolean", "array", "double", "object", "tree", "file","float","date","time","datetime"})
* @var string
*/
public $type = 'string';
/**
* 默认值
* @var string
*/
public $default;
/**
* 描述
* @var string
*/
public $desc;
/**
* 为tree类型时指定children字段
* @var string
*/
public $childrenField = '';
/**
* 为tree类型时指定children字段说明
* @var string
*/
public $childrenDesc = 'children';
/**
* 为array类型时指定子节点类型
* @Enum({"string", "int", "boolean", "array", "object"})
* @var string
*/
public $childrenType = '';
/**
* 指定引入的字段
* @var string
*/
public $field;
/**
* 指定从引入中过滤的字段
* @var string
*/
public $withoutField;
}

View File

@@ -0,0 +1,14 @@
<?php
namespace hg\apidoc\annotation;
use Doctrine\Common\Annotations\Annotation;
/**
* 参数类型
* @package hg\apidoc\annotation
* @Annotation
* @Target({"METHOD"})
*/
class ParamType extends Annotation
{}

View File

@@ -0,0 +1,34 @@
<?php
namespace hg\apidoc\annotation;
use Doctrine\Common\Annotations\Annotation;
/**
* 返回参数
* @package hg\apidoc\annotation
* @Annotation
* @Target({"METHOD","ANNOTATION"})
*/
final class Returned extends ParamBase
{
/**
* 必须
* @var bool
*/
public $require = false;
/**
* 引入
* @var string
*/
public $ref;
/**
* 是否替换全局响应体中的参数
* @var bool
*/
public $replaceGlobal = false;
}

View File

@@ -0,0 +1,17 @@
<?php
namespace hg\apidoc\annotation;
use Doctrine\Common\Annotations\Annotation\Enum;
final class Route extends Rule
{
/**
* 请求类型
* @Enum({"GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD"})
* @var string
*/
public $method = "GET";
}

View File

@@ -0,0 +1,77 @@
<?php
namespace hg\apidoc\annotation;
use Doctrine\Common\Annotations\Annotation;
abstract class Rule extends Annotation
{
/**
* @var string|array
*/
public $middleware;
/**
* 后缀
* @var string
*/
public $ext;
/**
* @var string
*/
public $deny_ext;
/**
* @var bool
*/
public $https;
/**
* @var string
*/
public $domain;
/**
* @var bool
*/
public $complete_match;
/**
* @var string|array
*/
public $cache;
/**
* @var bool
*/
public $ajax;
/**
* @var bool
*/
public $pjax;
/**
* @var bool
*/
public $json;
/**
* @var array
*/
public $filter;
/**
* @var array
*/
public $append;
public function getOptions()
{
return array_intersect_key(get_object_vars($this), array_flip([
'middleware', 'ext', 'deny_ext', 'https', 'domain', 'complete_match', 'cache', 'ajax', 'pjax', 'json', 'filter', 'append',
]));
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace hg\apidoc\annotation;
use Doctrine\Common\Annotations\Annotation;
/**
* 排序
* @package hg\apidoc\annotation
* @Annotation
* @Target({"CLASS"})
*/
class Sort extends Annotation
{}

14
vendor/hg/apidoc/src/annotation/Tag.php vendored Normal file
View File

@@ -0,0 +1,14 @@
<?php
namespace hg\apidoc\annotation;
use Doctrine\Common\Annotations\Annotation;
/**
* Tag
* @package hg\apidoc\annotation
* @Annotation
* @Target({"METHOD"})
*/
class Tag extends Annotation
{}

View File

@@ -0,0 +1,14 @@
<?php
namespace hg\apidoc\annotation;
use Doctrine\Common\Annotations\Annotation;
/**
* 标题
* @package hg\apidoc\annotation
* @Annotation
* @Target({"METHOD","CLASS"})
*/
class Title extends Annotation
{}

14
vendor/hg/apidoc/src/annotation/Url.php vendored Normal file
View File

@@ -0,0 +1,14 @@
<?php
namespace hg\apidoc\annotation;
use Doctrine\Common\Annotations\Annotation;
/**
* Url
* @package hg\apidoc\annotation
* @Annotation
* @Target({"METHOD"})
*/
class Url extends Annotation
{}

View File

@@ -0,0 +1,14 @@
<?php
namespace hg\apidoc\annotation;
use Doctrine\Common\Annotations\Annotation;
/**
* 排除模型的字段
* @package hg\apidoc\annotation
* @Annotation
* @Target({"METHOD"})
*/
class WithoutField extends Annotation
{}