Skip to content

Commit

Permalink
格式化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
xavieryang007 authored and liu21st committed Oct 26, 2018
1 parent 9c5f436 commit 5934dae
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion src/WebSocketFrame.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ public function offsetGet($offset)
{
return isset($this->data[$offset]) ? $this->data[$offset] : null;
}
}
}
84 changes: 42 additions & 42 deletions src/queue/Queue.php
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
<?php

namespace think\swoole\queue;

use think\facade\Config;

class Queue
{
protected $config;

/**
* config结构
* [
* "queueName"=>[
* "delay"=>0,//延迟时间
* "sleep"=>3,//休息时间
* "maxTries"=>0,//重试次数
* "nums"=>2//进程数量
* ],
* ]
*/
public function getConfig()
{
$config = Config::get('swoole.queue');
$this->config = $this->getDefaultsValue($config);
return $this->config;
}

public function getDefaultsValue($config = null)
{
if (!empty($config) && $config) {
foreach ($config as $key => $val) {
isset($config[$key]["delay"]) ? $config[$key] : ($config[$key]["delay"] = 0);
isset($config[$key]["sleep"]) ? $config[$key] : ($config[$key]["sleep"] = 3);
isset($config[$key]["maxTries"]) ? $config[$key] : ($config[$key]["maxTries"] = 0);
isset($config[$key]["nums"]) ? $config[$key] : ($config[$key]["nums"] = 1);
}
return $config;
}
return false;
}
}
<?php

namespace think\swoole\queue;

use think\facade\Config;

class Queue
{
protected $config;

/**
* config结构
* [
* "queueName"=>[
* "delay"=>0,//延迟时间
* "sleep"=>3,//休息时间
* "maxTries"=>0,//重试次数
* "nums"=>2//进程数量
* ],
* ]
*/
public function getConfig()
{
$config = Config::get('swoole.queue');
$this->config = $this->getDefaultsValue($config);
return $this->config;
}

public function getDefaultsValue($config = null)
{
if (!empty($config) && $config) {
foreach ($config as $key => $val) {
isset($config[$key]["delay"]) ? $config[$key] : ($config[$key]["delay"] = 0);
isset($config[$key]["sleep"]) ? $config[$key] : ($config[$key]["sleep"] = 3);
isset($config[$key]["maxTries"]) ? $config[$key] : ($config[$key]["maxTries"] = 0);
isset($config[$key]["nums"]) ? $config[$key] : ($config[$key]["nums"] = 1);
}
return $config;
}
return false;
}
}

0 comments on commit 5934dae

Please sign in to comment.