-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Squashed 'src/framework/' changes from ba1657b..b3a45be
b3a45be fix error on trigger event handler (#196) b1a48cd fix a bug when warnings appear in the high version of swoole (#195) 9c4da9f 自定义组件支持别名配置 (#181) bccf7a6 修复restart不能正常使用的BUG (#180) 97bfe2e 修改连接池配置的timeout字段为float (#177) 525097b 修改自定义组件只能扫描Aop、Command、Bootstrap三个文件的BUG (#169) 0b5f320 兼容swoole 4.0.3版本 (#166) 1d11b56 增加用户自定义组件配置 (#150) git-subtree-dir: src/framework git-subtree-split: b3a45be705c9cb53cb357925e228e4f60e6d76d5
- Loading branch information
Showing
22 changed files
with
361 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
namespace Swoft\Bean\Resource; | ||
|
||
use Swoft\Helper\ComposerHelper; | ||
|
||
trait CustomComponentsRegister | ||
{ | ||
/** | ||
* Register the server namespace | ||
* @author limx | ||
*/ | ||
public function registerServerNamespace() | ||
{ | ||
foreach ($this->customComponents as $ns => $componentDir) { | ||
if (is_int($ns)) { | ||
$ns = $componentDir; | ||
$componentDir = ComposerHelper::getDirByNamespace($ns); | ||
$ns = rtrim($ns, "\\"); | ||
$componentDir = rtrim($componentDir, "/"); | ||
} | ||
|
||
$this->componentNamespaces[] = $ns; | ||
$componentDir = alias($componentDir); | ||
|
||
foreach ($this->serverScan as $dir) { | ||
$scanDir = $componentDir . DS . $dir; | ||
if (!is_dir($scanDir)) { | ||
continue; | ||
} | ||
|
||
$scanNs = $ns . "\\" . $dir; | ||
$this->scanNamespaces[$scanNs] = $scanDir; | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Register the worker namespace | ||
* @author limx | ||
*/ | ||
public function registerWorkerNamespace() | ||
{ | ||
foreach ($this->customComponents as $ns => $componentDir) { | ||
if (is_int($ns)) { | ||
$ns = $componentDir; | ||
$componentDir = ComposerHelper::getDirByNamespace($ns); | ||
$ns = rtrim($ns, "\\"); | ||
$componentDir = rtrim($componentDir, "/"); | ||
} | ||
|
||
$this->componentNamespaces[] = $ns; | ||
$componentDir = alias($componentDir); | ||
|
||
if (!is_dir($componentDir)) { | ||
continue; | ||
} | ||
|
||
$scanDirs = scandir($componentDir, null); | ||
|
||
foreach ($scanDirs as $dir) { | ||
if ($dir == '.' || $dir == '..') { | ||
continue; | ||
} | ||
if (\in_array($dir, $this->serverScan, true)) { | ||
continue; | ||
} | ||
|
||
$scanDir = $componentDir . DS . $dir; | ||
|
||
if (!is_dir($scanDir)) { | ||
$this->scanFiles[$ns][] = $scanDir; | ||
continue; | ||
} | ||
$scanNs = $ns . '\\' . $dir; | ||
|
||
$this->scanNamespaces[$scanNs] = $scanDir; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
namespace SwoftTest\Connection; | ||
|
||
use Swoft\Pool\AbstractConnection; | ||
|
||
class DemoConnection extends AbstractConnection | ||
{ | ||
/** | ||
* @var Client | ||
*/ | ||
protected $connection; | ||
|
||
public function createConnection() | ||
{ | ||
$this->connection = new \stdClass(); | ||
$this->connection->id = uniqid(); | ||
} | ||
|
||
public function reconnect() | ||
{ | ||
$this->createConnection(); | ||
} | ||
|
||
public function check(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function getConnection() | ||
{ | ||
return $this->connection; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
namespace SwoftTest; | ||
|
||
use Swoft\Core\Coroutine; | ||
|
||
/** | ||
* Class CorouotineTest | ||
* | ||
* @package Swoft\Test\Cases | ||
*/ | ||
class CorouotineTest extends AbstractTestCase | ||
{ | ||
public function testIsSupportCoroutine() | ||
{ | ||
$this->assertTrue(Coroutine::isSupportCoroutine()); | ||
} | ||
|
||
public function testShouldWrapCoroutine() | ||
{ | ||
$this->assertFalse(Coroutine::shouldWrapCoroutine()); | ||
} | ||
} |
Oops, something went wrong.