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