Skip to content

Commit

Permalink
Squashed 'src/framework/' changes from 0d8bb66d..7003d920
Browse files Browse the repository at this point in the history
7003d920 Merge commit '30a1120da2a33a98360ee4da4e4586ad3412b5f2'
e8da8609 [fixed]eval error with void method (#92)
5cf5896c [fixed] logger->messages init error (#91)
52bbec6c Merge pull request #114 from aprchen/patch-1
847f23b4 fix spanid
c559c93e  add coWrite(); use swoft/swoole-ide-helper (#83)
21d268b7 change fix
e88a03f6 fix index err
620394d5 Merge commit '1643eb132396c22e6c9be8c90d123a31487455dd'
54f1675d Merge branch 'master' of https://github.com/swoft-cloud/swoft-component
8cf725ac refactor bean scan
d6c20a92 ws-server: bug fixed for connection info lost. fix cannot connect to root path
d91c68d1 add template of validator
e591de64 Merge branch 'master' of github.com:aprchen/swoft-component
001b46ed 格式修改,添加返回值类型,添加is_iterable兼容
1ea88d43 Update XmlHelper.php
fbfec258 Update XmlHelper.php
4fc2b08f Update XmlHelperTest.php
c38e5110 Update XmlHelperTest.php
9e65bc4b 格式化
4a1ef3db 添加xml解析,完善单元测试
1996c5b4 Merge pull request #2 from inhere/master
651ef229 new: add timezone setting. fix some bug for Config
4fbf22cb fix: bug fixed for array heleper
e828b7b3 up: change config() to config(key, default)
72aa48c6 add server type option
a5acf660 new: add global function config(). add new option for devtool
72e97a05 fix: The server object does not need a reference

git-subtree-dir: src/framework
git-subtree-split: 7003d920fb31936f59f7851f0acf81544e007fae
  • Loading branch information
huangzhhui committed Jun 12, 2018
1 parent 1643eb1 commit ab0f478
Show file tree
Hide file tree
Showing 34 changed files with 768 additions and 255 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
]
},
"require-dev": {
"eaglewu/swoole-ide-helper": "dev-master",
"swoft/swoole-ide-helper": "dev-master",
"phpunit/phpunit": "^5.7",
"friendsofphp/php-cs-fixer": "^2.10"
},
Expand Down
28 changes: 23 additions & 5 deletions src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class App
/**
* 服务器对象
*
* @var AbstractServer
* @var AbstractServer|\Swoft\Http\Server\Http\HttpServer|\Swoft\WebSocket\Server\WebSocketServer
*/
public static $server;

Expand Down Expand Up @@ -263,10 +263,10 @@ public static function setAliases(array $aliases)
}

/**
* 注册别名
* Set alias
*
* @param string $alias 别名
* @param string $path 路径
* @param string $alias alias
* @param string $path path
*
* @throws \InvalidArgumentException
*/
Expand Down Expand Up @@ -309,7 +309,7 @@ public static function setAlias(string $alias, string $path = null)
}

/**
* 获取别名路径
* Get alias
*
* @param string $alias
*
Expand Down Expand Up @@ -338,6 +338,24 @@ public static function getAlias(string $alias): string
return $rootPath . $aliasPath;
}

/**
* Is alias exist ?
*
* @param string $alias
*
* @return bool
* @throws \InvalidArgumentException
*/
public static function hasAlias(string $alias): bool
{
// empty OR not an alias
if (!$alias || $alias[0] !== '@') {
return false;
}

return isset(self::$aliases[$alias]);
}

/**
* trace级别日志
*
Expand Down
24 changes: 24 additions & 0 deletions src/Bean/Annotation/Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ class Enum
*/
private $values;

/**
* @var string
*/
private $template = '';

/**
* 默认值
*
Expand All @@ -61,6 +66,9 @@ public function __construct(array $values)
if (isset($values['default'])) {
$this->default = $values['default'];
}
if (isset($values['template'])) {
$this->template = $values['template'];
}
}

/**
Expand Down Expand Up @@ -94,4 +102,20 @@ public function getFrom(): string
{
return $this->from;
}

/**
* @return string
*/
public function getTemplate(): string
{
return $this->template;
}

/**
* @param string $template
*/
public function setTemplate(string $template)
{
$this->template = $template;
}
}
32 changes: 25 additions & 7 deletions src/Bean/Annotation/Floats.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@
namespace Swoft\Bean\Annotation;

/**
* 浮点数验证
* Floats
*
* @Annotation
* @Target("METHOD")
*
* @uses Floats
* @version 2017年11月13日
* @author stelin <[email protected]>
* @copyright Copyright 2010-2016 swoft software
* @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt}
*/
class Floats
{
Expand Down Expand Up @@ -42,6 +36,11 @@ class Floats
*/
private $max;

/**
* @var string
*/
private $template = '';

/**
* 默认值,如果是null,强制验证参数
*
Expand Down Expand Up @@ -71,6 +70,9 @@ public function __construct(array $values)
if (isset($values['default'])) {
$this->default = $values['default'];
}
if (isset($values['template'])) {
$this->template = $values['template'];
}
}

/**
Expand Down Expand Up @@ -112,4 +114,20 @@ public function getFrom(): string
{
return $this->from;
}

/**
* @return string
*/
public function getTemplate(): string
{
return $this->template;
}

/**
* @param string $template
*/
public function setTemplate(string $template)
{
$this->template = $template;
}
}
24 changes: 24 additions & 0 deletions src/Bean/Annotation/Integer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ class Integer
*/
private $max = PHP_INT_MAX;

/**
* @var string
*/
private $template = '';

/**
* 默认值,如果是null,强制验证参数
*
Expand Down Expand Up @@ -71,6 +76,9 @@ public function __construct(array $values)
if (isset($values['default'])) {
$this->default = $values['default'];
}
if (isset($values['template'])) {
$this->template = $values['template'];
}
}

/**
Expand Down Expand Up @@ -112,4 +120,20 @@ public function getFrom(): string
{
return $this->from;
}

/**
* @return string
*/
public function getTemplate(): string
{
return $this->template;
}

/**
* @param string $template
*/
public function setTemplate(string $template)
{
$this->template = $template;
}
}
24 changes: 24 additions & 0 deletions src/Bean/Annotation/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ class Number
*/
private $max = PHP_INT_MAX;

/**
* @var string
*/
private $template = '';

/**
* 默认值,如果是null,强制验证参数
*
Expand Down Expand Up @@ -71,6 +76,9 @@ public function __construct(array $values)
if (isset($values['default'])) {
$this->default = $values['default'];
}
if (isset($values['template'])) {
$this->template = $values['template'];
}
}

/**
Expand Down Expand Up @@ -112,4 +120,20 @@ public function getFrom(): string
{
return $this->from;
}

/**
* @return string
*/
public function getTemplate(): string
{
return $this->template;
}

/**
* @param string $template
*/
public function setTemplate(string $template)
{
$this->template = $template;
}
}
34 changes: 34 additions & 0 deletions src/Bean/Annotation/Strings.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ class Strings
*/
private $max = PHP_INT_MAX;

/**
* @var string
*/
private $template = '';

/**
* 默认值,如果是null,强制验证参数
*
Expand Down Expand Up @@ -65,6 +70,9 @@ public function __construct(array $values)
if (isset($values['default'])) {
$this->default = $values['default'];
}
if (isset($values['template'])) {
$this->template = $values['template'];
}
}

/**
Expand All @@ -77,11 +85,13 @@ public function getFrom(): string

/**
* @param string $from
*
* @return Strings
*/
public function setFrom(string $from): Strings
{
$this->from = $from;

return $this;
}

Expand All @@ -95,11 +105,13 @@ public function getName(): string

/**
* @param string $name
*
* @return Strings
*/
public function setName(string $name): Strings
{
$this->name = $name;

return $this;
}

Expand All @@ -113,11 +125,13 @@ public function getMin(): int

/**
* @param int $min
*
* @return Strings
*/
public function setMin(int $min): Strings
{
$this->min = $min;

return $this;
}

Expand All @@ -131,11 +145,13 @@ public function getMax(): int

/**
* @param int $max
*
* @return Strings
*/
public function setMax(int $max): Strings
{
$this->max = $max;

return $this;
}

Expand All @@ -149,11 +165,29 @@ public function getDefault()

/**
* @param null|string $default
*
* @return Strings
*/
public function setDefault($default): Strings
{
$this->default = $default;

return $this;
}

/**
* @return string
*/
public function getTemplate(): string
{
return $this->template;
}

/**
* @param string $template
*/
public function setTemplate(string $template)
{
$this->template = $template;
}
}
Loading

0 comments on commit ab0f478

Please sign in to comment.