-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
393 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Swoft\Stdlib; | ||
|
||
|
@@ -159,8 +167,8 @@ public function average($callback = null) | |
public function median($key = null) | ||
{ | ||
$values = (isset($key) ? $this->pluck($key) : $this)->filter(function ($item) { | ||
return $item !== null; | ||
})->sort()->values(); | ||
return $item !== null; | ||
})->sort()->values(); | ||
|
||
$count = $values->count(); | ||
|
||
|
@@ -197,7 +205,7 @@ public function mode($key = null): ?array | |
|
||
$counts = new self; | ||
|
||
$collection->each(function ($value) use ($counts) { | ||
$collection->each(function ($value) use ($counts): void { | ||
$counts[$value] = isset($counts[$value]) ? $counts[$value] + 1 : 1; | ||
}); | ||
|
||
|
@@ -310,9 +318,9 @@ public function dd(...$args): void | |
*/ | ||
public function dump(): self | ||
{ | ||
(new static(func_get_args()))->push($this)->each(function ($item) { | ||
var_dump($item); | ||
}); | ||
(new static(func_get_args()))->push($this)->each(function ($item): void { | ||
var_dump($item); | ||
}); | ||
|
||
return $this; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Swoft\Stdlib\Concern; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Swoft\Stdlib\Concern; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Swoft\Stdlib\Concern; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Swoft\Stdlib\Contract; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Swoft\Stdlib\Contract; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Swoft\Stdlib; | ||
|
||
|
||
use ArrayAccess; | ||
use JsonSerializable; | ||
use Swoft\Stdlib\Contract\Arrayable; | ||
|
@@ -19,7 +25,6 @@ | |
*/ | ||
class Fluent implements ArrayAccess, Arrayable, Jsonable, JsonSerializable | ||
{ | ||
|
||
/** | ||
* All of the attributes set on the fluent instance. | ||
* | ||
|
@@ -184,7 +189,7 @@ public function __get($key) | |
* | ||
* @return void | ||
*/ | ||
public function __set($key, $value) | ||
public function __set($key, $value): void | ||
{ | ||
$this->offsetSet($key, $value); | ||
} | ||
|
@@ -208,7 +213,7 @@ public function __isset($key) | |
* | ||
* @return void | ||
*/ | ||
public function __unset($key) | ||
public function __unset($key): void | ||
{ | ||
$this->offsetUnset($key); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Swoft\Stdlib\Helper; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Swoft\Stdlib\Helper; | ||
|
||
|
@@ -957,8 +965,10 @@ public static function has($array, $key): bool | |
} | ||
|
||
foreach (explode('.', $key) as $segment) { | ||
if ((is_array($array) && array_key_exists($segment, | ||
$array)) || ($array instanceof ArrayAccess && $array->offsetExists($segment)) | ||
if ((is_array($array) && array_key_exists( | ||
$segment, | ||
$array | ||
)) || ($array instanceof ArrayAccess && $array->offsetExists($segment)) | ||
) { | ||
$array = $array[$segment]; | ||
} else { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Swoft\Stdlib\Helper; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Swoft\Stdlib\Helper; | ||
|
||
|
@@ -9,5 +17,4 @@ | |
*/ | ||
final class Dir extends DirectoryHelper | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Swoft\Stdlib\Helper; | ||
|
||
|
@@ -9,5 +17,4 @@ | |
*/ | ||
final class DirHelper extends DirectoryHelper | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Swoft\Stdlib\Helper; | ||
|
||
|
@@ -81,7 +89,6 @@ public static function iterator(string $path): IteratorIterator | |
return new IteratorIterator($directoryIterator); | ||
} | ||
|
||
|
||
/** | ||
* Find all php files in the dir-path. | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Swoft\Stdlib\Helper; | ||
|
||
|
@@ -43,7 +50,9 @@ public static function getTags(string $comment, array $options = [], array $defa | |
|
||
$comment = str_replace("\r\n", "\n", $comment); | ||
$comment = "@{$default} \n" . | ||
str_replace("\r", '', | ||
str_replace( | ||
"\r", | ||
'', | ||
trim(preg_replace('/^\s*\**( |\t)?/m', '', $comment)) | ||
); | ||
|
||
|
@@ -135,4 +144,4 @@ public static function getPropertyDescription(string $className, string $propert | |
|
||
return $description; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Swoft\Stdlib\Helper; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Swoft\Stdlib\Helper; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Swoft\Stdlib\Helper; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
if (!function_exists('value')) { | ||
/** | ||
* Return the callback value | ||
|
@@ -53,7 +62,7 @@ function tap($value, Closure $callback = null) | |
* | ||
* @param mixed ...$vars | ||
*/ | ||
function printr(...$vars) | ||
function printr(...$vars): void | ||
{ | ||
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); | ||
|
||
|
@@ -78,7 +87,7 @@ function printr(...$vars) | |
* | ||
* @param mixed ...$vars | ||
*/ | ||
function vdump(...$vars) | ||
function vdump(...$vars): void | ||
{ | ||
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Swoft\Stdlib\Helper; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of Swoft. | ||
* | ||
* @link https://swoft.org | ||
* @document https://swoft.org/docs | ||
* @contact [email protected] | ||
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Swoft\Stdlib\Helper; | ||
|
||
|
Oops, something went wrong.