add
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Swoole\IDEHelper\StubGenerators;
|
||||
|
||||
use Swoole\IDEHelper\AbstractStubGenerator;
|
||||
use Swoole\IDEHelper\Constant;
|
||||
|
||||
/**
|
||||
* Class Swoole
|
||||
*
|
||||
* @package Swoole\IDEHelper\StubGenerators
|
||||
*/
|
||||
class Swoole extends AbstractStubGenerator
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function init(): AbstractStubGenerator
|
||||
{
|
||||
$this->extension = Constant::EXT_SWOOLE;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Swoole\IDEHelper\StubGenerators;
|
||||
|
||||
use Swoole\IDEHelper\AbstractStubGenerator;
|
||||
use Swoole\IDEHelper\Constant;
|
||||
|
||||
/**
|
||||
* Class SwooleAsync
|
||||
*
|
||||
* @package Swoole\IDEHelper\StubGenerators
|
||||
*/
|
||||
class SwooleAsync extends AbstractStubGenerator
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function init(): AbstractStubGenerator
|
||||
{
|
||||
$this->extension = Constant::EXT_SWOOLE_ASYNC;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Swoole\IDEHelper\StubGenerators;
|
||||
|
||||
use DirectoryIterator;
|
||||
use Swoole\IDEHelper\AbstractStubGenerator;
|
||||
use Swoole\IDEHelper\Constant;
|
||||
use Swoole\IDEHelper\Exception;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
|
||||
/**
|
||||
* Class SwooleLib
|
||||
*
|
||||
* @package Swoole\IDEHelper\StubGenerators
|
||||
* @see https://github.com/swoole/swoole-src/tree/master/library
|
||||
* @see https://github.com/swoole/swoole-src/blob/v4.5.6/ext-src/php_swoole_library.h#L5
|
||||
*/
|
||||
class SwooleLib extends AbstractStubGenerator
|
||||
{
|
||||
private const EXTRA_SRC_FILES = [
|
||||
"src/ext",
|
||||
"src/std",
|
||||
"src/constants.php",
|
||||
"src/functions.php",
|
||||
];
|
||||
|
||||
/**
|
||||
* AbstractStubGenerator constructor.
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->extension = "swoole_library";
|
||||
$this->dirOutput = dirname($this->dirOutput) . DIRECTORY_SEPARATOR . $this->extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function export(): void
|
||||
{
|
||||
$this->download("library", $this->rf_version, $this->dirOutput);
|
||||
|
||||
$extraFiles = self::EXTRA_SRC_FILES;
|
||||
/** @var DirectoryIterator $file */
|
||||
foreach (new DirectoryIterator($this->dirOutput) as $file) {
|
||||
if (!$file->isDot() && ($file->getFilename() != 'src')) {
|
||||
$extraFiles[] = $file->getFilename();
|
||||
}
|
||||
}
|
||||
$fileSystem = new Filesystem();
|
||||
foreach ($extraFiles as $file) {
|
||||
$fileSystem->remove($this->dirOutput . DIRECTORY_SEPARATOR . $file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function init(): AbstractStubGenerator
|
||||
{
|
||||
$this->extension = Constant::EXT_SWOOLE; // Set to a dummy value temporarily.
|
||||
$this->rf_version = $_SERVER["SWOOLE_LIB_VERSION"] ?? self::DEFAULT_VERSION;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Swoole\IDEHelper\StubGenerators;
|
||||
|
||||
use Swoole\IDEHelper\AbstractStubGenerator;
|
||||
use Swoole\IDEHelper\Constant;
|
||||
|
||||
/**
|
||||
* Class SwooleOrm
|
||||
*
|
||||
* @package Swoole\IDEHelper\StubGenerators
|
||||
*/
|
||||
class SwooleOrm extends AbstractStubGenerator
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function init(): AbstractStubGenerator
|
||||
{
|
||||
$this->extension = Constant::EXT_SWOOLE_ORM;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Swoole\IDEHelper\StubGenerators;
|
||||
|
||||
use Swoole\IDEHelper\AbstractStubGenerator;
|
||||
use Swoole\IDEHelper\Constant;
|
||||
|
||||
/**
|
||||
* Class SwoolePostgresql
|
||||
*
|
||||
* @package Swoole\IDEHelper\StubGenerators
|
||||
*/
|
||||
class SwoolePostgresql extends AbstractStubGenerator
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function init(): AbstractStubGenerator
|
||||
{
|
||||
$this->extension = Constant::EXT_SWOOLE_POSTGRESQL;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Swoole\IDEHelper\StubGenerators;
|
||||
|
||||
use Swoole\IDEHelper\AbstractStubGenerator;
|
||||
use Swoole\IDEHelper\Constant;
|
||||
|
||||
/**
|
||||
* Class SwooleSerialize
|
||||
*
|
||||
* @package Swoole\IDEHelper\StubGenerators
|
||||
*/
|
||||
class SwooleSerialize extends AbstractStubGenerator
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function init(): AbstractStubGenerator
|
||||
{
|
||||
$this->extension = Constant::EXT_SWOOLE_SERIALIZE;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Swoole\IDEHelper\StubGenerators;
|
||||
|
||||
use Swoole\IDEHelper\AbstractStubGenerator;
|
||||
use Swoole\IDEHelper\Constant;
|
||||
|
||||
/**
|
||||
* Class SwooleZookeeper
|
||||
*
|
||||
* @package Swoole\IDEHelper\StubGenerators
|
||||
*/
|
||||
class SwooleZookeeper extends AbstractStubGenerator
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function init(): AbstractStubGenerator
|
||||
{
|
||||
$this->extension = Constant::EXT_SWOOLE_ZOOKEEPER;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user