mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-05 05:07:58 +08:00
Deleted useless code.
This commit is contained in:
parent
099295e07a
commit
1c6f47f0f6
4
src/socketio-server/.gitignore
vendored
4
src/socketio-server/.gitignore
vendored
@ -1,4 +0,0 @@
|
||||
/vendor/
|
||||
composer.lock
|
||||
*.cache
|
||||
*.log
|
@ -1,87 +0,0 @@
|
||||
<?php
|
||||
|
||||
$header = <<<'EOF'
|
||||
This file is part of Hyperf.
|
||||
|
||||
@link https://www.hyperf.io
|
||||
@document https://doc.hyperf.io
|
||||
@contact group@hyperf.io
|
||||
@license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
EOF;
|
||||
|
||||
return PhpCsFixer\Config::create()
|
||||
->setRiskyAllowed(true)
|
||||
->setRules([
|
||||
'@PSR2' => true,
|
||||
'@Symfony' => true,
|
||||
'@DoctrineAnnotation' => true,
|
||||
'@PhpCsFixer' => true,
|
||||
'header_comment' => [
|
||||
'commentType' => 'PHPDoc',
|
||||
'header' => $header,
|
||||
'separate' => 'none',
|
||||
'location' => 'after_declare_strict',
|
||||
],
|
||||
'array_syntax' => [
|
||||
'syntax' => 'short'
|
||||
],
|
||||
'list_syntax' => [
|
||||
'syntax' => 'short'
|
||||
],
|
||||
'concat_space' => [
|
||||
'spacing' => 'one'
|
||||
],
|
||||
'blank_line_before_statement' => [
|
||||
'statements' => [
|
||||
'declare',
|
||||
],
|
||||
],
|
||||
'general_phpdoc_annotation_remove' => [
|
||||
'annotations' => [
|
||||
'author'
|
||||
],
|
||||
],
|
||||
'ordered_imports' => [
|
||||
'imports_order' => [
|
||||
'class', 'function', 'const',
|
||||
],
|
||||
'sort_algorithm' => 'alpha',
|
||||
],
|
||||
'single_line_comment_style' => [
|
||||
'comment_types' => [
|
||||
],
|
||||
],
|
||||
'yoda_style' => [
|
||||
'always_move_variable' => false,
|
||||
'equal' => false,
|
||||
'identical' => false,
|
||||
],
|
||||
'phpdoc_align' => [
|
||||
'align' => 'left',
|
||||
],
|
||||
'multiline_whitespace_before_semicolons' => [
|
||||
'strategy' => 'no_multi_line',
|
||||
],
|
||||
'class_attributes_separation' => true,
|
||||
'combine_consecutive_unsets' => true,
|
||||
'declare_strict_types' => true,
|
||||
'linebreak_after_opening_tag' => true,
|
||||
'lowercase_constants' => true,
|
||||
'lowercase_static_reference' => true,
|
||||
'no_useless_else' => true,
|
||||
'no_unused_imports' => true,
|
||||
'not_operator_with_successor_space' => true,
|
||||
'not_operator_with_space' => false,
|
||||
'ordered_class_elements' => true,
|
||||
'php_unit_strict' => false,
|
||||
'phpdoc_separation' => false,
|
||||
'single_quote' => true,
|
||||
'standardize_not_equals' => true,
|
||||
'multiline_comment_opening_closing' => true,
|
||||
])
|
||||
->setFinder(
|
||||
PhpCsFixer\Finder::create()
|
||||
->exclude('vendor')
|
||||
->in(__DIR__)
|
||||
)
|
||||
->setUsingCache(false);
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace PHPSTORM_META {
|
||||
// Reflect
|
||||
override(\Psr\Container\ContainerInterface::get(0), map('@'));
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
language: php
|
||||
|
||||
sudo: required
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- php: 7.2
|
||||
env: SW_VERSION="4.4.7"
|
||||
- php: 7.3
|
||||
env: SW_VERSION="4.4.7"
|
||||
- php: master
|
||||
env: SW_VERSION="4.4.7"
|
||||
|
||||
allow_failures:
|
||||
- php: master
|
||||
|
||||
services:
|
||||
- mysql
|
||||
- redis-server
|
||||
- docker
|
||||
|
||||
before_install:
|
||||
- export PHP_MAJOR="$(`phpenv which php` -r 'echo phpversion();' | cut -d '.' -f 1)"
|
||||
- export PHP_MINOR="$(`phpenv which php` -r 'echo phpversion();' | cut -d '.' -f 2)"
|
||||
- echo $PHP_MAJOR
|
||||
- echo $PHP_MINOR
|
||||
|
||||
install:
|
||||
- cd $TRAVIS_BUILD_DIR
|
||||
- bash ./tests/swoole.install.sh
|
||||
- phpenv config-rm xdebug.ini || echo "xdebug not available"
|
||||
- phpenv config-add ./tests/ci.ini
|
||||
|
||||
before_script:
|
||||
- cd $TRAVIS_BUILD_DIR
|
||||
- composer config -g process-timeout 900 && composer update
|
||||
|
||||
script:
|
||||
- composer analyse
|
||||
- composer test
|
21
src/socketio-server/LICENSE
Normal file
21
src/socketio-server/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit bootstrap="tests/bootstrap.php"
|
||||
backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
verbose="true"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false">
|
||||
<testsuite name="Testsuite">
|
||||
<directory>./tests/</directory>
|
||||
</testsuite>
|
||||
</phpunit>
|
@ -32,12 +32,11 @@ class AddRouteListener implements ListenerInterface
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function listen(): array
|
||||
{
|
||||
return [BootApplication::class];
|
||||
return [
|
||||
BootApplication::class,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -20,12 +20,11 @@ class ServerIdListener implements ListenerInterface
|
||||
{
|
||||
public function listen(): array
|
||||
{
|
||||
return [BeforeMainServerStart::class];
|
||||
return [
|
||||
BeforeMainServerStart::class,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function process(object $event)
|
||||
{
|
||||
SocketIO::$serverId = uniqid();
|
||||
|
@ -15,10 +15,20 @@ use Hyperf\Event\Contract\ListenerInterface;
|
||||
use Hyperf\Framework\Event\MainWorkerStart;
|
||||
use Hyperf\SocketIOServer\Collector\IORouter;
|
||||
use Hyperf\SocketIOServer\Room\RedisAdapter;
|
||||
use Hyperf\Utils\ApplicationContext;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
class StartSubscriberListener implements ListenerInterface
|
||||
{
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
private $container;
|
||||
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
public function listen(): array
|
||||
{
|
||||
return [
|
||||
@ -26,13 +36,10 @@ class StartSubscriberListener implements ListenerInterface
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function process(object $event)
|
||||
{
|
||||
foreach (IORouter::get('forward') as $class) {
|
||||
$instance = ApplicationContext::getContainer()->get($class);
|
||||
$instance = $this->container->get($class);
|
||||
if ($instance->getAdapter() instanceof RedisAdapter) {
|
||||
$instance->getAdapter()->subscribe();
|
||||
}
|
||||
|
@ -59,33 +59,21 @@ class Packet implements \ArrayAccess
|
||||
return $new;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->{$offset});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->{$offset};
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->{$offset} = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->{$offset});
|
||||
|
@ -139,7 +139,7 @@ class RedisAdapter implements AdapterInterface
|
||||
{
|
||||
Coroutine::create(function () {
|
||||
CoordinatorManager::get(Constants::ON_WORKER_START)->yield();
|
||||
retry((int) INF, function () {
|
||||
retry(PHP_INT_MAX, function () {
|
||||
$sub = ApplicationContext::getContainer()->get(Subscriber::class);
|
||||
if ($sub) {
|
||||
$this->mixSubscribe($sub);
|
||||
|
@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://doc.hyperf.io
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
require_once dirname(dirname(__FILE__)) . '/vendor/autoload.php';
|
@ -1,8 +0,0 @@
|
||||
[opcache]
|
||||
opcache.enable_cli=1
|
||||
|
||||
[redis]
|
||||
extension = "redis.so"
|
||||
|
||||
[swoole]
|
||||
extension = "swoole.so"
|
@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
wget https://github.com/swoole/swoole-src/archive/v"${SW_VERSION}".tar.gz -O swoole.tar.gz
|
||||
mkdir -p swoole
|
||||
tar -xf swoole.tar.gz -C swoole --strip-components=1
|
||||
rm swoole.tar.gz
|
||||
cd swoole || exit
|
||||
phpize
|
||||
./configure --enable-openssl --enable-mysqlnd
|
||||
make -j "$(nproc)"
|
||||
make install
|
Loading…
Reference in New Issue
Block a user