Skip to content
This repository was archived by the owner on Jan 23, 2019. It is now read-only.

Commit aa98304

Browse files
committed
format some file code
1 parent e10db11 commit aa98304

21 files changed

+97
-54
lines changed

src/auth/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function logout()
120120
unset($_SESSION[static::$saveKey]);
121121
}
122122

123-
/**
123+
/*
124124
* @param Request $request
125125
* @param Response $response
126126
* @return ResponseInterface

src/collections/ActiveData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function isStrict()
6868

6969
/**
7070
* @param bool $toArray
71-
* @return array
71+
* @return array|\ArrayIterator
7272
*/
7373
public function all($toArray = false)
7474
{

src/collections/Config.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public function __construct($data = [], $options = [], $name = 'config')
8383
* set config value by path
8484
* @param string $path
8585
* @param mixed $value
86+
* @return mixed
8687
*/
8788
public function set($path, $value)
8889
{
@@ -103,7 +104,7 @@ public function set($path, $value)
103104
public function get($path, $default = null)
104105
{
105106
if ( $this->mode === self::MODE_FOLDER ) {
106-
$nodes = static::getPathNodes($path, $separator);
107+
$nodes = static::getPathNodes($path, $this->separator);
107108
$name = array_shift($nodes);// config file name
108109

109110
// if config file not load. load it.

src/collections/DataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace inhere\librarys\collections;
1010

1111
use RuntimeException;
12-
use inhere\librarys\exceptions\DataParseException;
12+
use inhere\exceptions\DataParseException;
1313

1414
/**
1515
* Class DataCollector - 数据收集器 (数据存储器 - DataStorage)

src/collections/Local.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
<?php
32
/**
43
* Created by PhpStorm.
54
* User: Inhere

src/collections/SimpleCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public function offsetSet($key, $value)
214214
/**
215215
* Remove item from collection
216216
* @param string $key The data key
217-
* @return mixed|null|void
217+
* @return mixed|null
218218
*/
219219
public function offsetUnset($key)
220220
{

src/console/Color.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
namespace inhere\librarys\console;
1212

13-
use inhere\librarys\StdBase;
14-
1513
/**
1614
* Class Color
1715
* @package inhere\librarys\console
@@ -90,7 +88,7 @@ protected function addDefaultStyles()
9088
'options' => ['bold']
9189
])
9290
->addStyle('notice', [
93-
'options' => ['bold'], 'options' => ['underscore']
91+
'options' => ['bold','underscore'],
9492
])
9593
->addStyle('primary', [
9694
'fgColor' => 'blue', //'options' => ['bold']

src/console/ConsoleHelper.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?php
2-
2+
/**
3+
* Created by PhpStorm.
4+
* User: Inhere
5+
* Date: 16-4-1
6+
* Time: 上午10:08
7+
* Used:
8+
* file: Color.php
9+
*/
310

411
namespace inhere\librarys\console;
512

@@ -45,20 +52,21 @@ public static function isInteractive($fileDescriptor)
4552
/**
4653
* get key Max Width
4754
*
48-
* @param array $data
55+
* @param array $data
4956
* [
5057
* 'key1' => 'value1',
5158
* 'key2-test' => 'value2',
5259
* ]
60+
* @param bool $expectInt
5361
* @return int
5462
*/
55-
public static function getKeyMaxWidth(array $data, $expactInt = true)
63+
public static function getKeyMaxWidth(array $data, $expectInt = true)
5664
{
5765
$keyMaxWidth = 0;
5866

5967
foreach ($data as $key => $value) {
6068
// key is not a integer
61-
if ( !$expactInt || !is_numeric($key) ) {
69+
if ( !$expectInt || !is_numeric($key) ) {
6270
$width = mb_strlen($key, 'UTF-8');
6371
$keyMaxWidth = $width > $keyMaxWidth ? $width : $keyMaxWidth;
6472
}
@@ -74,7 +82,6 @@ public static function getKeyMaxWidth(array $data, $expactInt = true)
7482
* 'system' => 'Linux',
7583
* 'version' => '4.4.5',
7684
* ]
77-
* @param int $keyMaxWidth
7885
* @param array $opts
7986
* @return string
8087
*/
@@ -84,7 +91,7 @@ public static function spliceKeyValue(array $data, array $opts = [])
8491
$opts = array_merge([
8592
'leftChar' => '', // e.g ' ', ' * '
8693
'sepChar' => ' ', // e.g ' | ' => OUT: key | value
87-
'keyStyle' => '', // e.g 'info','commont'
94+
'keyStyle' => '', // e.g 'info','comment'
8895
'keyMaxWidth' => null, // if not set, will automatic calculation
8996
], $opts);
9097

@@ -106,14 +113,14 @@ public static function spliceKeyValue(array $data, array $opts = [])
106113
if ( is_array($value) ) {
107114
$temp = '';
108115

109-
foreach ($value as $key => $val) {
116+
foreach ($value as $k => $val) {
110117
if (is_bool($val)) {
111118
$val = $val ? 'True' : 'False';
112119
} else {
113120
$val = (string)$val;
114121
}
115122

116-
$temp .= (!is_numeric($key) ? "$key: " : '') . "<info>$val</info>, ";
123+
$temp .= (!is_numeric($k) ? "$k: " : '') . "<info>$val</info>, ";
117124
}
118125

119126
$value = rtrim($temp, ' ,');

src/console/Input.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ public function __construct($parseArgv = true, $fixServer = false, $fillToGlobal
5151

5252
/**
5353
* 读取输入信息
54-
* @param string $text 若不为空,则先输出文本消息
55-
* @param bool $nl true 会添加换行符 false 原样输出,不添加换行符
54+
* @param string $message 若不为空,则先输出文本消息
55+
* @param bool $nl true 会添加换行符 false 原样输出,不添加换行符
5656
* @return string
5757
*/
5858
public function read($message = null, $nl = false)
@@ -137,6 +137,9 @@ public function getInputStream()
137137
}
138138

139139
/**
140+
* @param bool $fixServer
141+
* @param bool $fillToGlobal
142+
* @return array
140143
*/
141144
public static function parseGlobalArgv($fixServer = false, $fillToGlobal = false)
142145
{

src/console/Interact.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
namespace inhere\librarys\console;
1212

13-
use inhere\librarys\exceptions\InvalidArgumentException;
1413

1514
/**
1615
* Class Interact
@@ -39,7 +38,7 @@ class Interact
3938
*/
4039
public static function select($description, $options, $default = null, $allowExit=true)
4140
{
42-
self::choice($description, $options, $default, $allowExit);
41+
return self::choice($description, $options, $default, $allowExit);
4342
}
4443
public static function choice($description, $options, $default = null, $allowExit=true)
4544
{
@@ -171,7 +170,7 @@ public static function question($question, $default = null, \Closure $validator
171170
* 否则,会连续询问 $allowed 次, 若仍然错误,退出
172171
* @param string $question 问题
173172
* @param null|string $default 默认值
174-
* @param callable $validator (默认验证输入是否为空)自定义回调验证输入是否符合要求; 验证成功返回true 否则 可返回错误消息
173+
* @param \Closure $validator (默认验证输入是否为空)自定义回调验证输入是否符合要求; 验证成功返回true 否则 可返回错误消息
175174
* @example This is an example
176175
*
177176
* ```
@@ -267,8 +266,9 @@ public static function title($msg, $width = 50)
267266
}
268267

269268
/**
270-
* @param string $msg The section message
271-
* @param int $width The section width
269+
* @param string $msg The section message
270+
* @param int $width The section width
271+
* @param string $char
272272
*/
273273
public static function section($msg, $width = 50, $char = '-')
274274
{
@@ -450,6 +450,7 @@ public static function panel($data, $title='Information Panel', $borderChar = '*
450450
* 表格数据信息展示
451451
* @param array $data
452452
* @param string $title
453+
* @param bool $showBorder
453454
* @return void
454455
*/
455456
public static function table(array $data, $title='Info List', $showBorder = true)

0 commit comments

Comments
 (0)