mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
规范代码
This commit is contained in:
@@ -11,19 +11,9 @@
|
||||
|
||||
namespace think;
|
||||
|
||||
use think\Config;
|
||||
use think\Env;
|
||||
use think\Exception;
|
||||
use think\exception\HttpException;
|
||||
use think\exception\HttpResponseException;
|
||||
use think\exception\RouteNotFoundException;
|
||||
use think\Hook;
|
||||
use think\Lang;
|
||||
use think\Loader;
|
||||
use think\Log;
|
||||
use think\Request;
|
||||
use think\Response;
|
||||
use think\Route;
|
||||
|
||||
/**
|
||||
* App 应用管理
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
namespace think;
|
||||
|
||||
use think\App;
|
||||
|
||||
class Cache
|
||||
{
|
||||
protected static $instance = [];
|
||||
|
||||
@@ -225,11 +225,11 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
|
||||
|
||||
$result = [];
|
||||
foreach ($this->items as $row) {
|
||||
$key = $value = null;
|
||||
$key = $value = null;
|
||||
$keySet = $valueSet = false;
|
||||
if (null !== $index_key && array_key_exists($index_key, $row)) {
|
||||
$keySet = true;
|
||||
$key = (string)$row[$index_key];
|
||||
$key = (string) $row[$index_key];
|
||||
}
|
||||
if (null === $column_key) {
|
||||
$valueSet = true;
|
||||
@@ -368,6 +368,6 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
|
||||
if ($items instanceof self) {
|
||||
return $items->all();
|
||||
}
|
||||
return (array)$items;
|
||||
return (array) $items;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ class Console
|
||||
|
||||
if (!$command->isEnabled()) {
|
||||
$command->setConsole(null);
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (null === $command->getDefinition()) {
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace think;
|
||||
|
||||
\think\Loader::import('controller/Jump', TRAIT_PATH, EXT);
|
||||
|
||||
use think\Exception;
|
||||
use think\exception\ValidateException;
|
||||
|
||||
class Controller
|
||||
|
||||
@@ -149,7 +149,7 @@ class Cookie
|
||||
}
|
||||
return $value;
|
||||
} else {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
namespace think;
|
||||
|
||||
use think\App;
|
||||
use think\Collection;
|
||||
use think\db\Query;
|
||||
use think\paginator\Collection as PaginatorCollection;
|
||||
|
||||
|
||||
@@ -11,11 +11,7 @@
|
||||
|
||||
namespace think;
|
||||
|
||||
use think\Config;
|
||||
use think\exception\ClassNotFoundException;
|
||||
use think\Log;
|
||||
use think\Request;
|
||||
use think\Response;
|
||||
use think\response\Redirect;
|
||||
|
||||
class Debug
|
||||
@@ -179,7 +175,7 @@ class Debug
|
||||
}
|
||||
if ($echo) {
|
||||
echo ($output);
|
||||
return null;
|
||||
return;
|
||||
} else {
|
||||
return $output;
|
||||
}
|
||||
|
||||
@@ -11,11 +11,6 @@
|
||||
|
||||
namespace think;
|
||||
|
||||
use think\App;
|
||||
use think\Debug;
|
||||
use think\Loader;
|
||||
use think\Log;
|
||||
|
||||
class Hook
|
||||
{
|
||||
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
|
||||
namespace think;
|
||||
|
||||
use think\App;
|
||||
use think\Cookie;
|
||||
use think\Log;
|
||||
|
||||
class Lang
|
||||
{
|
||||
// 语言数据
|
||||
|
||||
@@ -12,14 +12,8 @@
|
||||
namespace think;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use think\Cache;
|
||||
use think\Collection;
|
||||
use think\Config;
|
||||
use think\Db;
|
||||
use think\db\Query;
|
||||
use think\Exception;
|
||||
use think\Exception\ValidateException;
|
||||
use think\Loader;
|
||||
use think\model\Relation;
|
||||
use think\model\relation\BelongsTo;
|
||||
use think\model\relation\BelongsToMany;
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
namespace think;
|
||||
|
||||
use think\paginator\Collection as PaginatorCollection;
|
||||
use think\Request;
|
||||
|
||||
abstract class Paginator
|
||||
{
|
||||
@@ -42,14 +41,14 @@ abstract class Paginator
|
||||
'var_page' => 'page',
|
||||
'path' => '/',
|
||||
'query' => [],
|
||||
'fragment' => ''
|
||||
'fragment' => '',
|
||||
];
|
||||
|
||||
protected function __construct($items, $listRows, $currentPage = null, $total = null, $simple = false, $options = [])
|
||||
{
|
||||
$this->options = array_merge($this->options, $options);
|
||||
|
||||
$this->options['path'] = $this->options['path'] != '/' ? rtrim($this->options['path'], '/') : $this->options['path'];
|
||||
$this->options['path'] = '/' != $this->options['path'] ? rtrim($this->options['path'], '/') : $this->options['path'];
|
||||
|
||||
$this->simple = $simple;
|
||||
$this->listRows = $listRows;
|
||||
@@ -63,7 +62,7 @@ abstract class Paginator
|
||||
$items = $items->slice(0, $this->listRows);
|
||||
} else {
|
||||
$this->total = $total;
|
||||
$this->lastPage = (int)ceil($total / $listRows);
|
||||
$this->lastPage = (int) ceil($total / $listRows);
|
||||
$this->currentPage = $this->setCurrentPage($currentPage);
|
||||
$this->hasMore = $this->currentPage < $this->lastPage;
|
||||
}
|
||||
@@ -134,7 +133,7 @@ abstract class Paginator
|
||||
{
|
||||
$page = Request::instance()->request($varPage);
|
||||
|
||||
if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int)$page >= 1) {
|
||||
if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) {
|
||||
return $page;
|
||||
}
|
||||
|
||||
@@ -182,7 +181,7 @@ abstract class Paginator
|
||||
*/
|
||||
public function hasPages()
|
||||
{
|
||||
return !($this->currentPage == 1 && !$this->hasMore);
|
||||
return !(1 == $this->currentPage && !$this->hasMore);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -239,7 +238,6 @@ abstract class Paginator
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构造锚点字符串
|
||||
*
|
||||
@@ -255,4 +253,4 @@ abstract class Paginator
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function render();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@ namespace think;
|
||||
use think\process\exception\Failed as ProcessFailedException;
|
||||
use think\process\exception\Timeout as ProcessTimeoutException;
|
||||
use think\process\pipes\Pipes;
|
||||
use think\process\Utils;
|
||||
use think\process\pipes\Unix as UnixPipes;
|
||||
use think\process\pipes\Windows as WindowsPipes;
|
||||
use think\process\Utils;
|
||||
|
||||
class Process
|
||||
{
|
||||
@@ -47,10 +47,10 @@ class Process
|
||||
private $exitcode;
|
||||
private $fallbackExitcode;
|
||||
private $processInformation;
|
||||
private $outputDisabled = false;
|
||||
private $outputDisabled = false;
|
||||
private $stdout;
|
||||
private $stderr;
|
||||
private $enhanceWindowsCompatibility = true;
|
||||
private $enhanceWindowsCompatibility = true;
|
||||
private $enhanceSigchildCompatibility;
|
||||
private $process;
|
||||
private $status = self::STATUS_READY;
|
||||
@@ -147,7 +147,7 @@ class Process
|
||||
$this->enhanceSigchildCompatibility = '\\' !== DS && $this->isSigchildEnabled();
|
||||
$this->options = array_replace([
|
||||
'suppress_errors' => true,
|
||||
'binary_pipes' => true
|
||||
'binary_pipes' => true,
|
||||
], $options);
|
||||
}
|
||||
|
||||
@@ -490,7 +490,7 @@ class Process
|
||||
public function getExitCodeText()
|
||||
{
|
||||
if (null === $exitcode = $this->getExitCode()) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
|
||||
@@ -586,7 +586,7 @@ class Process
|
||||
*/
|
||||
public function isStarted()
|
||||
{
|
||||
return $this->status != self::STATUS_READY;
|
||||
return self::STATUS_READY != $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -597,7 +597,7 @@ class Process
|
||||
{
|
||||
$this->updateStatus(false);
|
||||
|
||||
return $this->status == self::STATUS_TERMINATED;
|
||||
return self::STATUS_TERMINATED == $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -645,7 +645,7 @@ class Process
|
||||
* @param string $line
|
||||
*/
|
||||
public function addOutput($line)
|
||||
{
|
||||
{
|
||||
$this->lastOutputTime = microtime(true);
|
||||
$this->stdout .= $line;
|
||||
}
|
||||
@@ -655,7 +655,7 @@ class Process
|
||||
* @param string $line
|
||||
*/
|
||||
public function addErrorOutput($line)
|
||||
{
|
||||
{
|
||||
$this->lastOutputTime = microtime(true);
|
||||
$this->stderr .= $line;
|
||||
}
|
||||
@@ -665,7 +665,7 @@ class Process
|
||||
* @return string
|
||||
*/
|
||||
public function getCommandLine()
|
||||
{
|
||||
{
|
||||
return $this->commandline;
|
||||
}
|
||||
|
||||
@@ -675,7 +675,7 @@ class Process
|
||||
* @return self
|
||||
*/
|
||||
public function setCommandLine($commandline)
|
||||
{
|
||||
{
|
||||
$this->commandline = $commandline;
|
||||
|
||||
return $this;
|
||||
@@ -686,7 +686,7 @@ class Process
|
||||
* @return float|null
|
||||
*/
|
||||
public function getTimeout()
|
||||
{
|
||||
{
|
||||
return $this->timeout;
|
||||
}
|
||||
|
||||
@@ -695,7 +695,7 @@ class Process
|
||||
* @return float|null
|
||||
*/
|
||||
public function getIdleTimeout()
|
||||
{
|
||||
{
|
||||
return $this->idleTimeout;
|
||||
}
|
||||
|
||||
@@ -705,7 +705,7 @@ class Process
|
||||
* @return self
|
||||
*/
|
||||
public function setTimeout($timeout)
|
||||
{
|
||||
{
|
||||
$this->timeout = $this->validateTimeout($timeout);
|
||||
|
||||
return $this;
|
||||
@@ -717,7 +717,7 @@ class Process
|
||||
* @return self
|
||||
*/
|
||||
public function setIdleTimeout($timeout)
|
||||
{
|
||||
{
|
||||
if (null !== $timeout && $this->outputDisabled) {
|
||||
throw new \LogicException('Idle timeout can not be set while the output is disabled.');
|
||||
}
|
||||
@@ -733,7 +733,7 @@ class Process
|
||||
* @return self
|
||||
*/
|
||||
public function setTty($tty)
|
||||
{
|
||||
{
|
||||
if ('\\' === DS && $tty) {
|
||||
throw new \RuntimeException('TTY mode is not supported on Windows platform.');
|
||||
}
|
||||
@@ -741,7 +741,7 @@ class Process
|
||||
throw new \RuntimeException('TTY mode requires /dev/tty to be readable.');
|
||||
}
|
||||
|
||||
$this->tty = (bool)$tty;
|
||||
$this->tty = (bool) $tty;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -751,7 +751,7 @@ class Process
|
||||
* @return bool
|
||||
*/
|
||||
public function isTty()
|
||||
{
|
||||
{
|
||||
return $this->tty;
|
||||
}
|
||||
|
||||
@@ -761,8 +761,8 @@ class Process
|
||||
* @return self
|
||||
*/
|
||||
public function setPty($bool)
|
||||
{
|
||||
$this->pty = (bool)$bool;
|
||||
{
|
||||
$this->pty = (bool) $bool;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -772,7 +772,7 @@ class Process
|
||||
* @return bool
|
||||
*/
|
||||
public function isPty()
|
||||
{
|
||||
{
|
||||
return $this->pty;
|
||||
}
|
||||
|
||||
@@ -781,7 +781,7 @@ class Process
|
||||
* @return string|null
|
||||
*/
|
||||
public function getWorkingDirectory()
|
||||
{
|
||||
{
|
||||
if (null === $this->cwd) {
|
||||
return getcwd() ?: null;
|
||||
}
|
||||
@@ -795,7 +795,7 @@ class Process
|
||||
* @return self
|
||||
*/
|
||||
public function setWorkingDirectory($cwd)
|
||||
{
|
||||
{
|
||||
$this->cwd = $cwd;
|
||||
|
||||
return $this;
|
||||
@@ -806,7 +806,7 @@ class Process
|
||||
* @return array
|
||||
*/
|
||||
public function getEnv()
|
||||
{
|
||||
{
|
||||
return $this->env;
|
||||
}
|
||||
|
||||
@@ -816,14 +816,14 @@ class Process
|
||||
* @return self
|
||||
*/
|
||||
public function setEnv(array $env)
|
||||
{
|
||||
{
|
||||
$env = array_filter($env, function ($value) {
|
||||
return !is_array($value);
|
||||
});
|
||||
|
||||
$this->env = [];
|
||||
foreach ($env as $key => $value) {
|
||||
$this->env[(binary)$key] = (binary)$value;
|
||||
$this->env[(binary) $key] = (binary) $value;
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -834,7 +834,7 @@ class Process
|
||||
* @return null|string
|
||||
*/
|
||||
public function getInput()
|
||||
{
|
||||
{
|
||||
return $this->input;
|
||||
}
|
||||
|
||||
@@ -844,7 +844,7 @@ class Process
|
||||
* @return self
|
||||
*/
|
||||
public function setInput($input)
|
||||
{
|
||||
{
|
||||
if ($this->isRunning()) {
|
||||
throw new \LogicException('Input can not be set while the process is running.');
|
||||
}
|
||||
@@ -859,7 +859,7 @@ class Process
|
||||
* @return array
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
@@ -869,7 +869,7 @@ class Process
|
||||
* @return self
|
||||
*/
|
||||
public function setOptions(array $options)
|
||||
{
|
||||
{
|
||||
$this->options = $options;
|
||||
|
||||
return $this;
|
||||
@@ -880,7 +880,7 @@ class Process
|
||||
* @return bool
|
||||
*/
|
||||
public function getEnhanceWindowsCompatibility()
|
||||
{
|
||||
{
|
||||
return $this->enhanceWindowsCompatibility;
|
||||
}
|
||||
|
||||
@@ -890,8 +890,8 @@ class Process
|
||||
* @return self
|
||||
*/
|
||||
public function setEnhanceWindowsCompatibility($enhance)
|
||||
{
|
||||
$this->enhanceWindowsCompatibility = (bool)$enhance;
|
||||
{
|
||||
$this->enhanceWindowsCompatibility = (bool) $enhance;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -901,7 +901,7 @@ class Process
|
||||
* @return bool
|
||||
*/
|
||||
public function getEnhanceSigchildCompatibility()
|
||||
{
|
||||
{
|
||||
return $this->enhanceSigchildCompatibility;
|
||||
}
|
||||
|
||||
@@ -911,8 +911,8 @@ class Process
|
||||
* @return self
|
||||
*/
|
||||
public function setEnhanceSigchildCompatibility($enhance)
|
||||
{
|
||||
$this->enhanceSigchildCompatibility = (bool)$enhance;
|
||||
{
|
||||
$this->enhanceSigchildCompatibility = (bool) $enhance;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -921,8 +921,8 @@ class Process
|
||||
* 是否超时
|
||||
*/
|
||||
public function checkTimeout()
|
||||
{
|
||||
if ($this->status !== self::STATUS_STARTED) {
|
||||
{
|
||||
if (self::STATUS_STARTED !== $this->status) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -944,7 +944,7 @@ class Process
|
||||
* @return bool
|
||||
*/
|
||||
public static function isPtySupported()
|
||||
{
|
||||
{
|
||||
static $result;
|
||||
|
||||
if (null !== $result) {
|
||||
@@ -970,7 +970,7 @@ class Process
|
||||
* @return array
|
||||
*/
|
||||
private function getDescriptors()
|
||||
{
|
||||
{
|
||||
if ('\\' === DS) {
|
||||
$this->processPipes = WindowsPipes::create($this, $this->input);
|
||||
} else {
|
||||
@@ -994,7 +994,7 @@ class Process
|
||||
* @return callable
|
||||
*/
|
||||
protected function buildCallback($callback)
|
||||
{
|
||||
{
|
||||
$out = self::OUT;
|
||||
$callback = function ($type, $data) use ($callback, $out) {
|
||||
if ($out == $type) {
|
||||
@@ -1016,7 +1016,7 @@ class Process
|
||||
* @param bool $blocking
|
||||
*/
|
||||
protected function updateStatus($blocking)
|
||||
{
|
||||
{
|
||||
if (self::STATUS_STARTED !== $this->status) {
|
||||
return;
|
||||
}
|
||||
@@ -1036,7 +1036,7 @@ class Process
|
||||
* @return bool
|
||||
*/
|
||||
protected function isSigchildEnabled()
|
||||
{
|
||||
{
|
||||
if (null !== self::$sigchild) {
|
||||
return self::$sigchild;
|
||||
}
|
||||
@@ -1057,8 +1057,8 @@ class Process
|
||||
* @return float|null
|
||||
*/
|
||||
private function validateTimeout($timeout)
|
||||
{
|
||||
$timeout = (float)$timeout;
|
||||
{
|
||||
$timeout = (float) $timeout;
|
||||
|
||||
if (0.0 === $timeout) {
|
||||
$timeout = null;
|
||||
@@ -1075,15 +1075,15 @@ class Process
|
||||
* @param bool $close
|
||||
*/
|
||||
private function readPipes($blocking, $close)
|
||||
{
|
||||
{
|
||||
$result = $this->processPipes->readAndWrite($blocking, $close);
|
||||
|
||||
$callback = $this->callback;
|
||||
foreach ($result as $type => $data) {
|
||||
if (3 == $type) {
|
||||
$this->fallbackExitcode = (int)$data;
|
||||
$this->fallbackExitcode = (int) $data;
|
||||
} else {
|
||||
$callback($type === self::STDOUT ? self::OUT : self::ERR, $data);
|
||||
$callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1092,7 +1092,7 @@ class Process
|
||||
* 捕获退出码
|
||||
*/
|
||||
private function captureExitCode()
|
||||
{
|
||||
{
|
||||
if (isset($this->processInformation['exitcode']) && -1 != $this->processInformation['exitcode']) {
|
||||
$this->exitcode = $this->processInformation['exitcode'];
|
||||
}
|
||||
@@ -1103,7 +1103,7 @@ class Process
|
||||
* @return int 退出码
|
||||
*/
|
||||
private function close()
|
||||
{
|
||||
{
|
||||
$this->processPipes->close();
|
||||
if (is_resource($this->process)) {
|
||||
$exitcode = proc_close($this->process);
|
||||
@@ -1117,7 +1117,7 @@ class Process
|
||||
if (-1 === $this->exitcode && null !== $this->fallbackExitcode) {
|
||||
$this->exitcode = $this->fallbackExitcode;
|
||||
} elseif (-1 === $this->exitcode && $this->processInformation['signaled']
|
||||
&& 0 < $this->processInformation['termsig']
|
||||
&& 0 < $this->processInformation['termsig']
|
||||
) {
|
||||
$this->exitcode = 128 + $this->processInformation['termsig'];
|
||||
}
|
||||
@@ -1129,7 +1129,7 @@ class Process
|
||||
* 重置数据
|
||||
*/
|
||||
private function resetProcessData()
|
||||
{
|
||||
{
|
||||
$this->starttime = null;
|
||||
$this->callback = null;
|
||||
$this->exitcode = null;
|
||||
@@ -1151,7 +1151,7 @@ class Process
|
||||
* @return bool
|
||||
*/
|
||||
private function doSignal($signal, $throwException)
|
||||
{
|
||||
{
|
||||
if (!$this->isRunning()) {
|
||||
if ($throwException) {
|
||||
throw new \LogicException('Can not send signal on a non running process.');
|
||||
@@ -1186,7 +1186,7 @@ class Process
|
||||
* @param string $functionName
|
||||
*/
|
||||
private function requireProcessIsStarted($functionName)
|
||||
{
|
||||
{
|
||||
if (!$this->isStarted()) {
|
||||
throw new \LogicException(sprintf('Process must be started before calling %s.', $functionName));
|
||||
}
|
||||
@@ -1197,9 +1197,9 @@ class Process
|
||||
* @param string $functionName
|
||||
*/
|
||||
private function requireProcessIsTerminated($functionName)
|
||||
{
|
||||
{
|
||||
if (!$this->isTerminated()) {
|
||||
throw new \LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,11 +11,6 @@
|
||||
|
||||
namespace think;
|
||||
|
||||
use think\Config;
|
||||
use think\Exception;
|
||||
use think\File;
|
||||
use think\Session;
|
||||
|
||||
class Request
|
||||
{
|
||||
/**
|
||||
@@ -891,7 +886,7 @@ class Request
|
||||
return $array[$name];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,11 +11,6 @@
|
||||
|
||||
namespace think;
|
||||
|
||||
use think\Cache;
|
||||
use think\Config;
|
||||
use think\Debug;
|
||||
use think\Env;
|
||||
use think\Request;
|
||||
use think\response\Json as JsonResponse;
|
||||
use think\response\Jsonp as JsonpResponse;
|
||||
use think\response\Redirect as RedirectResponse;
|
||||
|
||||
@@ -11,14 +11,7 @@
|
||||
|
||||
namespace think;
|
||||
|
||||
use think\App;
|
||||
use think\Config;
|
||||
use think\exception\HttpException;
|
||||
use think\Hook;
|
||||
use think\Loader;
|
||||
use think\Log;
|
||||
use think\Request;
|
||||
use think\Response;
|
||||
|
||||
class Route
|
||||
{
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
namespace think;
|
||||
|
||||
use think\App;
|
||||
use think\exception\ClassNotFoundException;
|
||||
|
||||
class Session
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
namespace think;
|
||||
|
||||
use think\exception\TemplateNotFoundException;
|
||||
use think\Request;
|
||||
|
||||
/**
|
||||
* ThinkPHP分离出来的模板引擎
|
||||
@@ -130,7 +129,7 @@ class Template
|
||||
} elseif (isset($this->config[$config])) {
|
||||
return $this->config[$config];
|
||||
} else {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -669,7 +668,7 @@ class Template
|
||||
$content = str_replace($matches[0], '', $content);
|
||||
return explode(',', $matches['name']);
|
||||
}
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,11 +11,6 @@
|
||||
|
||||
namespace think;
|
||||
|
||||
use think\Config;
|
||||
use think\Loader;
|
||||
use think\Request;
|
||||
use think\Route;
|
||||
|
||||
class Url
|
||||
{
|
||||
// 生成URL地址的root
|
||||
|
||||
@@ -11,13 +11,7 @@
|
||||
|
||||
namespace think;
|
||||
|
||||
use think\Db;
|
||||
use think\exception\ClassNotFoundException;
|
||||
use think\File;
|
||||
use think\Lang;
|
||||
use think\Loader;
|
||||
use think\Request;
|
||||
use think\Session;
|
||||
|
||||
class Validate
|
||||
{
|
||||
|
||||
@@ -11,9 +11,6 @@
|
||||
|
||||
namespace think;
|
||||
|
||||
use think\Loader;
|
||||
use think\Request;
|
||||
|
||||
class View
|
||||
{
|
||||
// 视图实例
|
||||
|
||||
2
library/think/cache/Driver.php
vendored
2
library/think/cache/Driver.php
vendored
@@ -105,7 +105,7 @@ abstract class Driver
|
||||
$this->rm($name);
|
||||
return $result;
|
||||
} else {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1
library/think/cache/driver/Memcache.php
vendored
1
library/think/cache/driver/Memcache.php
vendored
@@ -12,7 +12,6 @@
|
||||
namespace think\cache\driver;
|
||||
|
||||
use think\cache\Driver;
|
||||
use think\Exception;
|
||||
|
||||
class Memcache extends Driver
|
||||
{
|
||||
|
||||
1
library/think/cache/driver/Sqlite.php
vendored
1
library/think/cache/driver/Sqlite.php
vendored
@@ -12,7 +12,6 @@
|
||||
namespace think\cache\driver;
|
||||
|
||||
use think\cache\Driver;
|
||||
use think\Exception;
|
||||
|
||||
/**
|
||||
* Sqlite缓存驱动
|
||||
|
||||
3
library/think/cache/driver/Wincache.php
vendored
3
library/think/cache/driver/Wincache.php
vendored
@@ -12,7 +12,6 @@
|
||||
namespace think\cache\driver;
|
||||
|
||||
use think\cache\Driver;
|
||||
use think\Exception;
|
||||
|
||||
/**
|
||||
* Wincache缓存驱动
|
||||
@@ -28,7 +27,7 @@ class Wincache extends Driver
|
||||
/**
|
||||
* 架构函数
|
||||
* @param array $options 缓存参数
|
||||
* @throws Exception
|
||||
* @throws \BadFunctionCallException
|
||||
* @access public
|
||||
*/
|
||||
public function __construct($options = [])
|
||||
|
||||
1
library/think/cache/driver/Xcache.php
vendored
1
library/think/cache/driver/Xcache.php
vendored
@@ -12,7 +12,6 @@
|
||||
namespace think\cache\driver;
|
||||
|
||||
use think\cache\Driver;
|
||||
use think\Exception;
|
||||
|
||||
/**
|
||||
* Xcache缓存驱动
|
||||
|
||||
@@ -252,7 +252,7 @@ class Input
|
||||
|
||||
return $token;
|
||||
}
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,6 @@ use think\console\Input;
|
||||
use think\console\input\Argument as InputArgument;
|
||||
use think\console\input\Option as InputOption;
|
||||
use think\console\Output;
|
||||
use think\console\helper\Descriptor as DescriptorHelper;
|
||||
|
||||
class Help extends Command
|
||||
{
|
||||
@@ -67,4 +66,4 @@ EOF
|
||||
|
||||
$this->command = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class Schema extends Command
|
||||
}
|
||||
$output->writeln('<info>Succeed!</info>');
|
||||
return;
|
||||
} else if ($input->hasOption('table')) {
|
||||
} elseif ($input->hasOption('table')) {
|
||||
$table = $input->getOption('table');
|
||||
if (!strpos($table, '.')) {
|
||||
$dbName = Db::getConfig('database');
|
||||
|
||||
@@ -196,7 +196,7 @@ class Console
|
||||
private function getSttyColumns()
|
||||
{
|
||||
if (!function_exists('proc_open')) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
$descriptorspec = [1 => ['pipe', 'w'], 2 => ['pipe', 'w']];
|
||||
@@ -209,7 +209,7 @@ class Console
|
||||
|
||||
return $info;
|
||||
}
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,7 +234,7 @@ class Console
|
||||
return $matches[2] . 'x' . $matches[1];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
private function stringWidth($string)
|
||||
@@ -356,10 +356,10 @@ class Console
|
||||
{
|
||||
if (DIRECTORY_SEPARATOR === '\\') {
|
||||
return
|
||||
'10.0.10586' === PHP_WINDOWS_VERSION_MAJOR . '.' . PHP_WINDOWS_VERSION_MINOR . '.' . PHP_WINDOWS_VERSION_BUILD
|
||||
|| false !== getenv('ANSICON')
|
||||
|| 'ON' === getenv('ConEmuANSI')
|
||||
|| 'xterm' === getenv('TERM');
|
||||
'10.0.10586' === PHP_WINDOWS_VERSION_MAJOR . '.' . PHP_WINDOWS_VERSION_MINOR . '.' . PHP_WINDOWS_VERSION_BUILD
|
||||
|| false !== getenv('ANSICON')
|
||||
|| 'ON' === getenv('ConEmuANSI')
|
||||
|| 'xterm' === getenv('TERM');
|
||||
}
|
||||
|
||||
return function_exists('posix_isatty') && @posix_isatty($stream);
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
namespace think\db;
|
||||
|
||||
use PDO;
|
||||
use think\Db;
|
||||
use think\db\Connection;
|
||||
use think\db\Query;
|
||||
use think\Exception;
|
||||
|
||||
abstract class Builder
|
||||
|
||||
@@ -16,7 +16,6 @@ use PDOStatement;
|
||||
use think\Collection;
|
||||
use think\Db;
|
||||
use think\db\exception\BindParamException;
|
||||
use think\db\Query;
|
||||
use think\Debug;
|
||||
use think\Exception;
|
||||
use think\exception\PDOException;
|
||||
|
||||
@@ -16,8 +16,6 @@ use think\Cache;
|
||||
use think\Collection;
|
||||
use think\Config;
|
||||
use think\Db;
|
||||
use think\db\Builder;
|
||||
use think\db\Connection;
|
||||
use think\db\exception\BindParamException;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
namespace think\exception;
|
||||
|
||||
use think\exception\DbException;
|
||||
|
||||
/**
|
||||
* PDO异常处理类
|
||||
* 重新封装了系统的\PDOException类
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
namespace think\exception;
|
||||
|
||||
use think\exception\HttpException;
|
||||
|
||||
class RouteNotFoundException extends HttpException
|
||||
{
|
||||
|
||||
|
||||
@@ -209,19 +209,19 @@ class Socket
|
||||
}
|
||||
|
||||
if (!isset($_SERVER[$key])) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
if (empty($args)) {
|
||||
if (!preg_match('/SocketLog\((.*?)\)/', $_SERVER[$key], $match)) {
|
||||
$args = ['tabid' => null];
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
parse_str($match[1], $args);
|
||||
}
|
||||
if (isset($args[$name])) {
|
||||
return $args[$name];
|
||||
}
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
namespace think\model\relation;
|
||||
|
||||
use think\Model;
|
||||
use think\model\relation\OneToOne;
|
||||
|
||||
class BelongsTo extends OneToOne
|
||||
{
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
namespace think\model\relation;
|
||||
|
||||
use think\Model;
|
||||
use think\model\relation\OneToOne;
|
||||
|
||||
class HasOne extends OneToOne
|
||||
{
|
||||
|
||||
@@ -16,7 +16,6 @@ use think\Exception;
|
||||
use think\Loader;
|
||||
use think\Model;
|
||||
use think\model\Relation;
|
||||
use think\model\relation\BelongsTo;
|
||||
|
||||
abstract class OneToOne extends Relation
|
||||
{
|
||||
|
||||
@@ -15,10 +15,9 @@ use think\Process;
|
||||
|
||||
class Builder
|
||||
{
|
||||
|
||||
private $arguments;
|
||||
private $cwd;
|
||||
private $env = null;
|
||||
private $env = null;
|
||||
private $input;
|
||||
private $timeout = 60;
|
||||
private $options = [];
|
||||
@@ -155,7 +154,7 @@ class Builder
|
||||
return $this;
|
||||
}
|
||||
|
||||
$timeout = (float)$timeout;
|
||||
$timeout = (float) $timeout;
|
||||
|
||||
if ($timeout < 0) {
|
||||
throw new \InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
|
||||
@@ -231,4 +230,4 @@ class Builder
|
||||
|
||||
return $process;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class Utils
|
||||
return $input;
|
||||
}
|
||||
if (is_scalar($input)) {
|
||||
return (string)$input;
|
||||
return (string) $input;
|
||||
}
|
||||
throw new \InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
|
||||
}
|
||||
@@ -72,4 +72,4 @@ class Utils
|
||||
return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
namespace think\process\exception;
|
||||
|
||||
|
||||
use think\Process;
|
||||
|
||||
class Failed extends \RuntimeException
|
||||
@@ -25,14 +25,14 @@ class Unix extends Pipes
|
||||
|
||||
public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
|
||||
{
|
||||
$this->ttyMode = (bool)$ttyMode;
|
||||
$this->ptyMode = (bool)$ptyMode;
|
||||
$this->disableOutput = (bool)$disableOutput;
|
||||
$this->ttyMode = (bool) $ttyMode;
|
||||
$this->ptyMode = (bool) $ptyMode;
|
||||
$this->disableOutput = (bool) $disableOutput;
|
||||
|
||||
if (is_resource($input)) {
|
||||
$this->input = $input;
|
||||
} else {
|
||||
$this->inputBuffer = (string)$input;
|
||||
$this->inputBuffer = (string) $input;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,12 +134,12 @@ class Unix extends Pipes
|
||||
|
||||
$type = (false !== $found = array_search($pipe, $this->pipes)) ? $found : 'input';
|
||||
$data = '';
|
||||
while ('' !== $dataread = (string)fread($pipe, self::CHUNK_SIZE)) {
|
||||
while ('' !== $dataread = (string) fread($pipe, self::CHUNK_SIZE)) {
|
||||
$data .= $dataread;
|
||||
}
|
||||
|
||||
if ('' !== $data) {
|
||||
if ($type === 'input') {
|
||||
if ('input' === $type) {
|
||||
$this->inputBuffer .= $data;
|
||||
} else {
|
||||
$read[$type] = $data;
|
||||
@@ -147,7 +147,7 @@ class Unix extends Pipes
|
||||
}
|
||||
|
||||
if (false === $data || (true === $close && feof($pipe) && '' === $data)) {
|
||||
if ($type === 'input') {
|
||||
if ('input' === $type) {
|
||||
$this->input = null;
|
||||
} else {
|
||||
fclose($this->pipes[$type]);
|
||||
@@ -160,7 +160,7 @@ class Unix extends Pipes
|
||||
while (strlen($this->inputBuffer)) {
|
||||
$written = fwrite($w[0], $this->inputBuffer, 2 << 18); // write 512k
|
||||
if ($written > 0) {
|
||||
$this->inputBuffer = (string)substr($this->inputBuffer, $written);
|
||||
$this->inputBuffer = (string) substr($this->inputBuffer, $written);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ class Unix extends Pipes
|
||||
*/
|
||||
public function areOpen()
|
||||
{
|
||||
return (bool)$this->pipes;
|
||||
return (bool) $this->pipes;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -193,4 +193,4 @@ class Unix extends Pipes
|
||||
{
|
||||
return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class Windows extends Pipes
|
||||
|
||||
public function __construct($disableOutput, $input)
|
||||
{
|
||||
$this->disableOutput = (bool)$disableOutput;
|
||||
$this->disableOutput = (bool) $disableOutput;
|
||||
|
||||
if (!$this->disableOutput) {
|
||||
|
||||
@@ -128,7 +128,7 @@ class Windows extends Pipes
|
||||
*/
|
||||
public function areOpen()
|
||||
{
|
||||
return (bool)$this->pipes && (bool)$this->fileHandles;
|
||||
return (bool) $this->pipes && (bool) $this->fileHandles;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -213,7 +213,7 @@ class Windows extends Pipes
|
||||
while (strlen($this->inputBuffer)) {
|
||||
$written = fwrite($w[0], $this->inputBuffer, 2 << 18);
|
||||
if ($written > 0) {
|
||||
$this->inputBuffer = (string)substr($this->inputBuffer, $written);
|
||||
$this->inputBuffer = (string) substr($this->inputBuffer, $written);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@@ -225,4 +225,4 @@ class Windows extends Pipes
|
||||
unset($this->pipes[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace traits\think;
|
||||
|
||||
use \think\Exception;
|
||||
use think\Exception;
|
||||
|
||||
trait Instance
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user