diff --git a/app/common/controller/BaseController.php b/app/common/controller/BaseController.php
index cbd5604..2e414b3 100644
--- a/app/common/controller/BaseController.php
+++ b/app/common/controller/BaseController.php
@@ -16,7 +16,6 @@ use think\facade\Request;
use think\facade\View;
use think\facade\Db;
use think\facade\Session;
-use think\facade\Cache;
use app\BaseController as BaseCtrl;
/**
@@ -62,28 +61,28 @@ class BaseController extends BaseCtrl
private function setUid()
{
if(Session::has('user_id')) {
- $this->uid = Session::get('user_id');
+ $this->uid = Session::get('user_id') ?? -1;
}
}
private function setUser()
{
if(Session::has('user_id')) {
- $this->uid = Session::get('user_id');
+ $this->uid = Session::get('user_id') ?? -1;
}
}
// 显示子导航subnav
protected function showSubnav()
{
+ $subCateList = []; // 没有点击任何分类,点击首页获取全部分类信息
//1.查询父分类id
$pCate = Db::name('cate')->field('id,pid,ename,catename,is_hot')->where(['ename'=>input('ename'),'status'=>1,'delete_time'=>0])->find();
- if(empty($pCate)) { // 没有点击任何分类,点击首页获取全部分类信息
- $subCateList = [];
- } else { // 点击分类,获取子分类信息
+ if(!is_null($pCate)) { // 点击分类,获取子分类信息
$parentId = $pCate['id'];
$subCate = Db::name('cate')->field('id,ename,catename,is_hot,pid')->where(['pid'=>$parentId,'status'=>1,'delete_time'=>0])->select()->toArray();
+
if(!empty($subCate)) { // 有子分类
$subCateList = array2tree($subCate);
} else { //无子分类
@@ -106,16 +105,13 @@ class BaseController extends BaseCtrl
//显示当前登录用户
protected function showUser($id)
{
- $user = Cache::get('user'.$id);
- if(!$user){
- //1.查询用户
- $user = Db::name('user')
- ->alias('u')
- ->join('user_viprule v','v.vip = u.vip')
- ->field('u.id as id,v.id as vid,name,nickname,user_img,sex,area_id,auth,city,phone,email,active,sign,point,u.vip as vip,nick,u.create_time as cteate_time')
- ->find($id);
- Cache::tag('user')->set('user'.$id, $user, 600);
- }
+ if($id == -1) return [];
+ //1.查询用户
+ $user = Db::name('user')
+ ->alias('u')
+ ->join('user_viprule v','v.vip = u.vip')
+ ->field('u.id as id,v.id as vid,name,nickname,user_img,sex,area_id,auth,city,phone,email,active,sign,point,u.vip as vip,nick,u.create_time as create_time')
+ ->find((int)$id);
return $user;
}
diff --git a/app/common/lib/SqlFile.php b/app/common/lib/SqlFile.php
index c843ae2..9f111bd 100644
--- a/app/common/lib/SqlFile.php
+++ b/app/common/lib/SqlFile.php
@@ -2,11 +2,11 @@
/*
* @Author: TaoLer <317927823@qq.com>
* @Date: 2021-12-06 16:04:50
- * @LastEditTime: 2022-08-16 14:16:40
+ * @LastEditTime: 2024-04-12 19:32:40
* @LastEditors: TaoLer
* @Description: 优化版
* @FilePath: \TaoLer\app\common\lib\SqlFile.php
- * Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
+ * Copyright (c) 2020~2024 https://www.aieok.com All rights reserved.
*/
declare (strict_types = 1);
@@ -84,6 +84,9 @@ class SqlFile
if (file_exists($sqlFile)) {
$sqlArr = self::loadSqlFile($sqlFile);
if(!empty($sqlArr)) {
+ $orginal = 'tao_'; //sql默认表前缀
+ $prefix = config('database.mysql.prefix'); // 现在表前缀
+ ($orginal == $prefix) ? true : $sqlArr = str_replace(" `{$orginal}", " `{$prefix}", $sqlArr); //替换数组中表前缀
foreach($sqlArr as $v){
try {
Db::execute($v);
diff --git a/app/common/model/Article.php b/app/common/model/Article.php
index 5d4739e..db89579 100644
--- a/app/common/model/Article.php
+++ b/app/common/model/Article.php
@@ -110,10 +110,10 @@ class Article extends Model
*/
public function getArtTop(int $num)
{
-
return Cache::remember('topArticle', function() use($num){
+ $topIdArr = $this::where(['is_top' => 1, 'status' => 1])->limit($num)->column('id');
return $this::field('id,title,title_color,cate_id,user_id,create_time,is_top,pv,upzip,has_img,has_video,has_audio,read_type')
- ->where(['is_top' => 1, 'status' => 1])
+ ->where('id', 'in', $topIdArr)
->with([
'cate' => function (Query $query) {
$query->where('delete_time', 0)->field('id,catename,ename');
@@ -122,8 +122,7 @@ class Article extends Model
$query->field('id,name,nickname,user_img');
}
])->withCount(['comments'])
- ->order('create_time', 'desc')
- ->limit($num)
+ ->order('id', 'desc')
->append(['url'])
->select()
->toArray();
@@ -151,8 +150,9 @@ class Article extends Model
} ])
->withCount(['comments'])
->where('status', '=', 1)
- ->order('create_time','desc')
+ ->order('id','desc')
->limit($num)
+ ->hidden(['art_pass'])
->append(['url'])
->select();
@@ -163,7 +163,7 @@ class Article extends Model
/**
* 热点文章
- * @param int $num 热点列表数量
+ * @param int $num 热点列表数量 评论或者pv排序
* @return \think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
@@ -171,17 +171,48 @@ class Article extends Model
*/
public function getArtHot(int $num)
{
- $artHot = $this::field('id,cate_id,title,create_time')
- ->withCount('comments')
- ->where(['status' => 1])
- ->whereMonth('create_time')
- ->order('comments_count','desc')
- ->limit($num)
- ->withCache(600)
- ->append(['url'])
- ->select();
+ return Cache::remember('article_hot', function() use($num){
+ $comments = Comment::field('article_id,count(*) as count')
+ ->where('comment.delete_time',0)
+ ->hasWhere('article',['status' =>1, 'delete_time' => 0])
+ ->group('article_id')
+ ->order('count','desc')
+ ->limit($num)
+ ->select();
+ $idArr = [];
+ foreach($comments as $v) {
+ $idArr[] = $v->article_id;
+ }
+ $where = [];
+ if(count($idArr)) {
+ // 评论数
+ $where = [
+ ['id', 'in', $idArr]
+ ];
- return $artHot;
+ $artHot = $this::field('id,cate_id,title,create_time')
+ ->withCount('comments')
+ ->where($where)
+ //->whereYear('create_time')
+ // ->order('comments_count','desc')
+ ->append(['url'])
+ ->select();
+ } else {
+ // pv数
+ $where = [
+ ['status', '=', 1]
+ ];
+ $artHot = $this::field('id,cate_id,title,create_time')
+ ->withCount('comments')
+ ->where($where)
+ ->whereMonth('create_time')
+ ->order('pv','desc')
+ ->limit($num)
+ ->append(['url'])
+ ->select();
+ }
+ return $artHot;
+ }, 3600);
}
/**
@@ -223,12 +254,6 @@ class Article extends Model
*/
public function getCateList(string $ename, string $type, int $page = 1)
{
- $where = [];
- $cateId = Cate::where('ename',$ename)->value('id');
- if($cateId){
- $where[] = ['cate_id' ,'=', $cateId];
- }
-
switch ($type) {
//查询文章,15个分1页
case 'jie':
@@ -244,10 +269,28 @@ class Article extends Model
$where[] = ['jie','=', 0];
break;
}
+
$where[] = ['status', '=', 1];
- return Cache::remember('cate_list_'.$ename.$type.$page, function() use($where,$page){
- return $this::field('id,cate_id,user_id,title,content,title_color,create_time,is_top,is_hot,pv,jie,upzip,has_img,has_video,has_audio,read_type,art_pass')
+ return Cache::remember('cate_list_'.$ename.$type.$page, function() use($where,$ename,$page){
+ $cateId = Cate::where('ename',$ename)->value('id');
+ if($cateId){
+ $where[] = ['cate_id' ,'=', $cateId];
+ }
+
+ $list = $this::field('id')->where($where)->order(['id'=>'desc'])->paginate([
+ 'list_rows' => 15,
+ 'page' => $page
+ ])->toArray();
+
+ $idArr = [];
+ if($list['total'] > 0) {
+ foreach($list['data'] as $v) {
+ $idArr[] = $v['id'];
+ }
+ }
+
+ $data = $this::field('id,cate_id,user_id,title,content,title_color,create_time,is_top,is_hot,pv,jie,upzip,has_img,has_video,has_audio,read_type,art_pass')
->with([
'cate' => function($query) {
$query->field('id,catename,ename');
@@ -256,13 +299,19 @@ class Article extends Model
$query->field('id,name,nickname,user_img,vip');
}
])->withCount(['comments'])
- ->where($where)
- ->limit(15)
- ->order(['create_time'=>'desc'])
- ->paginate([
- 'list_rows' => 15,
- 'page' => $page
- ])->append(['url'])->toArray();
+ ->where('id','in',$idArr)
+ ->order(['id'=>'desc'])
+ ->append(['url'])
+ ->hidden(['art_pass'])
+ ->select()
+ ->toArray();
+ return [
+ 'total' => $list['total'],
+ 'per_page' => $list['per_page'],
+ 'current_page' => $list['current_page'],
+ 'last_page' => $list['last_page'],
+ 'data' => $data
+ ];
}, 600);
}
@@ -273,7 +322,7 @@ class Article extends Model
$query->where(['delete_time'=>0,'status'=>1])->field('id,ename');
}])
->where(['user_id' => $id,'status' => 1])
- ->order(['create_time'=>'desc'])
+ ->order('id','desc')
->append(['url'])
->limit(25)
->cache(3600)
@@ -296,7 +345,7 @@ class Article extends Model
$map[] = ['title','like','%'.$keywords.'%'];
$res = Article::where($map)
->withCount('comments')
- ->order('create_time','desc')
+ ->order('id','desc')
->append(['url'])
->paginate(10);
@@ -363,23 +412,33 @@ class Article extends Model
* @param [type] $cid 当前分类ID
* @return void|array
*/
- public function getPrevNextArticle($id,$cid)
+ public function getPrevNextArticle($id, $cid)
{
//上一篇
- $previous = $this::field('id,title,cate_id')
- ->where([
- ['id', '<', $id],
+ $pIds = $this::where([
+ ['id', '>=', $id], // >= <= 条件可以使用索引
['cate_id', '=', $cid],
['status', '=',1]
- ])->order('id desc')->limit(1)->append(['url'])->select()->toArray();
+ ])->order('id asc')->limit(2)->column('id');
+ if(count($pIds) === 2) {
+ $previous = $this::field('id,title,cate_id')->append(['url'])->find($pIds[1])->toArray();
+ } else {
+ $previous = [];
+ }
+
//下一篇
- $next = $this::field('id,title,cate_id')
- ->where([
- ['id', '>', $id],
+ $nids = $this::where([
+ ['id', '<=', $id],
['cate_id', '=', $cid],
['status', '=',1]
- ])->order('id asc')->limit(1)->append(['url'])->select()->toArray();
+ ])->order('id desc')->limit(2)->column('id');
+
+ if(count($nids) === 2) {
+ $next = $this::field('id,title,cate_id')->append(['url'])->find($nids[1])->toArray();
+ } else {
+ $next = [];
+ }
return ['previous' => $previous, 'next' => $next];
}
@@ -398,7 +457,7 @@ class Article extends Model
])
->where(['status' => 1])
->where($where)
- ->order('create_time', 'desc')
+ ->order('id', 'desc')
->paginate([
'list_rows' => $limit,
'page' => $page
@@ -418,7 +477,7 @@ class Article extends Model
}
])
->where($where)
- ->order('create_time', 'desc')
+ ->order('id', 'desc')
->paginate([
'list_rows' => $limit,
'page' => $page
diff --git a/app/common/model/Cate.php b/app/common/model/Cate.php
index 5a25eeb..d655ee2 100644
--- a/app/common/model/Cate.php
+++ b/app/common/model/Cate.php
@@ -63,12 +63,12 @@ class Cate extends Model
public function del($id)
{
$cates = $this->field('id,pid')->with('article')->find($id);
- $sonCate = $this->field('id,pid')->where('pid',$cates['id'])->find();
- if(empty($sonCate)) {
- $res = $cates->together(['article'])->delete();
- return $res ? 1 : '删除失败';
+ $sonCate = $this::where('pid',$cates['id'])->count();
+ if($sonCate > 0) {
+ return '存在子分类,无法删除';
}
- return '存在子分类,无法删除';
+ $res = $cates->together(['article'])->delete();
+ return $res ? 1 : '删除失败';
}
// 分类表
@@ -121,11 +121,11 @@ class Cate extends Model
public function getUrlAttr($value,$data)
{
// 栏目下存在帖子,则返回正常url,否则为死链
- $articleArr = Article::field('id')->where('cate_id', $data['id'])->find();
- if(empty($articleArr)) {
- return 'javascript:void(0);';
+ $articleCount = Article::where('cate_id', $data['id'])->count();
+ if($articleCount > 0) {
+ return (string) url('cate',['ename' => $data['ename']]);
}
- return (string) url('cate',['ename' => $data['ename']]);;
+ return 'javascript:void(0);';
}
diff --git a/app/common/model/MessageTo.php b/app/common/model/MessageTo.php
index cf4738c..e264a1b 100644
--- a/app/common/model/MessageTo.php
+++ b/app/common/model/MessageTo.php
@@ -33,12 +33,11 @@ class MessageTo extends Model
//得到消息数
public function getMsgNum($id)
{
- $msg = $this::where(['receve_id'=>$id,'is_read'=>0])->column('id');
- if($num = count($msg)) {
- return $num;
- } else {
- return 0;
+ $msgNum = $this::where(['receve_id'=>$id,'is_read'=>0])->count('id');
+ if($msgNum) {
+ return $msgNum;
}
+ return 0;
}
diff --git a/app/index/controller/Article.php b/app/index/controller/Article.php
index e00ad97..6b2f3f1 100644
--- a/app/index/controller/Article.php
+++ b/app/index/controller/Article.php
@@ -50,6 +50,7 @@ class Article extends BaseController
//分类列表
$artList = $this->model->getCateList($ename,$type,$page);
+ // halt($artList);
// 热议文章
$artHot = $this->model->getArtHot(10);
@@ -118,15 +119,15 @@ class Article extends BaseController
//上一篇下一篇
$upDownArt = $this->model->getPrevNextArticle($id,$artDetail['cate_id']);
- if(empty($upDownArt['previous'][0])) {
+ if(empty($upDownArt['previous'])) {
$previous = '前面已经没有了!';
} else {
- $previous = '' . $upDownArt['previous'][0]['title'] . '';
+ $previous = '' . $upDownArt['previous']['title'] . '';
}
- if(empty($upDownArt['next'][0])) {
+ if(empty($upDownArt['next'])) {
$next = '已经是最新的内容了!';
} else {
- $next = '' . $upDownArt['next'][0]['title'] . '';
+ $next = '' . $upDownArt['next']['title'] . '';
}
//评论
@@ -440,7 +441,7 @@ class Article extends BaseController
*/
public function delete()
{
- $article = $this->model->find(input('id'));
+ $article = $this->model->find((int)input('id'));
$result = $article->together(['comments'])->delete();
if($result) {
return Msgres::success('delete_success');
diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php
index 1b36cb4..fa14c81 100644
--- a/app/index/controller/Index.php
+++ b/app/index/controller/Index.php
@@ -11,7 +11,6 @@
namespace app\index\controller;
use app\common\controller\BaseController;
-use app\common\lib\facade\HttpHelper;
use think\facade\View;
use think\facade\Request;
use think\facade\Db;
@@ -32,6 +31,22 @@ class Index extends BaseController
*/
public function index()
{
+
+ // $res = get_addons_info('callme1');
+// halt($res);
+ // $htmlString = "
这是一个链接和其他文本。
";
+ // $cleanString = preg_replace("/]*>(.*?)<\/a>/is", "", $htmlString);
+ // //$cleanString = preg_replace("(]*>|)","",$htmlString);
+ // echo $cleanString;
+
+ // $ip = file_get_contents('https://myip.ipip.net');
+ // echo "My public IP address is: " . $ip;
+ // $alipay = AlipayFactory::createPayMethod();
+ // $weixin = WeixinFactory::createPayMethod();
+ // $a = $alipay->index();
+ // $b= $weixin->index();
+ // var_dump($a,$b);
+
$types = input('type');
//置顶文章
$artTop = Article::getArtTop(5);
diff --git a/app/index/controller/Message.php b/app/index/controller/Message.php
index d4ea961..9640860 100644
--- a/app/index/controller/Message.php
+++ b/app/index/controller/Message.php
@@ -11,7 +11,6 @@
namespace app\index\controller;
use app\common\controller\BaseController;
-use think\facade\Session;
use think\facade\Request;
use think\facade\Db;
use app\common\model\Message as MessageModel;
@@ -25,12 +24,8 @@ class Message extends BaseController
{
$messgeto = new MessageTo();
$num = $messgeto->getMsgNum($this->uid);
- if($num){
- $res = ['status' =>0,'count' => $num, 'msg' => 'ok'];
- } else {
- $res = ['status' =>0,'count' => 0, 'msg' => 'no message'];
- }
- return json($res);
+ if($num) return json(['status' =>0,'count' => $num, 'msg' => 'ok']);
+ return json(['status' =>0,'count' => 0, 'msg' => 'no message']);
}
//消息查询
@@ -82,18 +77,20 @@ class Message extends BaseController
$uid = $this->uid;
$id = Request::only(['id']);
+
if($id['id'] == 'true'){
- //删除所有此用户消息
- $msg = Db::name('message_to')->where(['receve_id'=>$uid,'delete_time'=>0])->useSoftDelete('delete_time',time())->delete();
+ // id为'true' 删除所有此用户消息
+ $msg = Db::name('message_to')->where(['receve_id' => $uid])->delete();
} else {
//删除单条消息
- $msg = Db::name('message_to')->where('id',$id['id'])->useSoftDelete('delete_time',time())->delete();
+ $msg = Db::name('message_to')->where('id', $id['id'])->delete();
}
if($msg){
$res = ['status'=>0];
+ return $res;
}
- return $res;
+
}
diff --git a/app/index/controller/User.php b/app/index/controller/User.php
index 9e4af32..0e46263 100644
--- a/app/index/controller/User.php
+++ b/app/index/controller/User.php
@@ -301,11 +301,8 @@ class User extends BaseController
public function home($id)
{
//用户
- $u = Cache::get('user'.$id);
- if(!$u){
- $u = Db::name('user')->field('name,nickname,city,sex,sign,user_img,point,vip,create_time')->cache(3600)->find($id);
- }
-
+ $u = Db::name('user')->field('name,nickname,city,sex,sign,user_img,point,vip,create_time')->find($id);
+
$article = new Article();
$arts = $article->getUserArtList((int) $id);
@@ -320,7 +317,7 @@ class User extends BaseController
->field('a.id,a.title,t.ename,c.content,c.create_time,c.delete_time,c.status')
->where(['a.delete_time'=>0,'c.delete_time'=>0,'c.status'=>1])
->where('c.user_id',$id)
- ->order(['c.create_time'=>'desc'])
+ ->order(['c.id'=>'desc'])
->limit(10)
->cache(3600)->select();
diff --git a/app/install/data/taoler.sql b/app/install/data/taoler.sql
index e611f55..ab73084 100644
--- a/app/install/data/taoler.sql
+++ b/app/install/data/taoler.sql
@@ -430,7 +430,8 @@ CREATE TABLE `tao_message_to` (
`create_time` int NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int NOT NULL DEFAULT 0 COMMENT '更新时间',
`delete_time` int NOT NULL DEFAULT 0 COMMENT '删除时间',
- PRIMARY KEY (`id`) USING BTREE
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_mesto_receveid`(`receve_id`) USING BTREE COMMENT '收件人ID'
) ENGINE = MyISAM AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '消息详细表' ROW_FORMAT = Dynamic;
-- ----------------------------
diff --git a/composer.lock b/composer.lock
index e193c8e..65fe03c 100644
--- a/composer.lock
+++ b/composer.lock
@@ -799,16 +799,16 @@
},
{
"name": "jaeger/querylist",
- "version": "V4.2.8",
+ "version": "V4.2.9",
"source": {
"type": "git",
"url": "https://github.com/jae-jae/QueryList.git",
- "reference": "39dc0ca9c668bec7a793e20472ccd7d26ef89ea4"
+ "reference": "7aae3aed38214d3d7096174faf49f6c41b2dd550"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/jae-jae/QueryList/zipball/39dc0ca9c668bec7a793e20472ccd7d26ef89ea4",
- "reference": "39dc0ca9c668bec7a793e20472ccd7d26ef89ea4",
+ "url": "https://api.github.com/repos/jae-jae/QueryList/zipball/7aae3aed38214d3d7096174faf49f6c41b2dd550",
+ "reference": "7aae3aed38214d3d7096174faf49f6c41b2dd550",
"shasum": ""
},
"require": {
@@ -816,11 +816,10 @@
"jaeger/g-http": "^1.1",
"jaeger/phpquery-single": "^1",
"php": ">=7.1",
- "tightenco/collect": ">5.0"
+ "symfony/var-dumper": ">3.4"
},
"require-dev": {
- "phpunit/phpunit": "^8.5",
- "symfony/var-dumper": "^3.3"
+ "phpunit/phpunit": "^8.5"
},
"type": "library",
"autoload": {
@@ -847,7 +846,7 @@
],
"support": {
"issues": "https://github.com/jae-jae/QueryList/issues",
- "source": "https://github.com/jae-jae/QueryList/tree/V4.2.8"
+ "source": "https://github.com/jae-jae/QueryList/tree/V4.2.9"
},
"funding": [
{
@@ -855,7 +854,7 @@
"type": "open_collective"
}
],
- "time": "2021-07-05T06:07:58+00:00"
+ "time": "2024-04-12T06:29:50+00:00"
},
{
"name": "laravel/serializable-closure",
@@ -2404,61 +2403,6 @@
},
"time": "2022-04-16T23:08:43+00:00"
},
- {
- "name": "tightenco/collect",
- "version": "v8.83.27",
- "source": {
- "type": "git",
- "url": "https://github.com/tighten/collect.git",
- "reference": "07eed6cf7441c7a69c379fdcb118eec1a1fdd0e6"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/tighten/collect/zipball/07eed6cf7441c7a69c379fdcb118eec1a1fdd0e6",
- "reference": "07eed6cf7441c7a69c379fdcb118eec1a1fdd0e6",
- "shasum": ""
- },
- "require": {
- "php": "^7.3|^8.0",
- "symfony/var-dumper": "^3.4 || ^4.0 || ^5.0 || ^6.0"
- },
- "require-dev": {
- "mockery/mockery": "^1.0",
- "nesbot/carbon": "^2.23.0",
- "phpunit/phpunit": "^8.3"
- },
- "type": "library",
- "autoload": {
- "files": [
- "src/Collect/Support/helpers.php",
- "src/Collect/Support/alias.php"
- ],
- "psr-4": {
- "Tightenco\\Collect\\": "src/Collect"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Taylor Otwell",
- "email": "taylorotwell@gmail.com"
- }
- ],
- "description": "Collect - Illuminate Collections as a separate package.",
- "keywords": [
- "collection",
- "laravel"
- ],
- "support": {
- "issues": "https://github.com/tighten/collect/issues",
- "source": "https://github.com/tighten/collect/tree/v8.83.27"
- },
- "abandoned": "illuminate/collections",
- "time": "2023-01-13T18:05:42+00:00"
- },
{
"name": "topthink/framework",
"version": "v6.1.4",
diff --git a/config/taoler.php b/config/taoler.php
index e0b5f84..f73a77e 100644
--- a/config/taoler.php
+++ b/config/taoler.php
@@ -16,7 +16,7 @@ return [
// 应用名,此项不可更改
'appname' => 'TaoLer',
// 版本配置
- 'version' => '2.5.5',
+ 'version' => '2.5.6',
// 加盐
'salt' => 'taoler',
// 数据库备份目录
diff --git a/public/static/res/css/global.css b/public/static/res/css/global.css
index 2657d74..de73aca 100644
--- a/public/static/res/css/global.css
+++ b/public/static/res/css/global.css
@@ -434,7 +434,6 @@ body .layui-edit-face .layui-layer-content{padding:0; background-color:#fff; co
.jie-row li i, .jie-row li em, .jie-row li cite{font-size:12px; color:#999; font-style: normal;}
.jie-row li .mine-edit{margin-left:15px; padding:0 6px; background-color: #8FCDA0; color:#fff; font-size:12px;}
.jie-row li em{position:absolute; right:0; top:0;}
-.jie-row li .jie-user{}
.jie-row li .jie-title{max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
.jie-row li .jie-user img{position:relative; top: 16px; width: 35px; height: 35px;}
@@ -792,7 +791,7 @@ p {
margin: 0;
white-space: normal;
word-break: break-all;
- -webkit-user-select: none;
+ /* -webkit-user-select: none; */
}
code[class*="language-"], pre[class*="language-"] {
diff --git a/public/static/res/mods/index.js b/public/static/res/mods/index.js
index a93bcf8..9792c33 100644
--- a/public/static/res/mods/index.js
+++ b/public/static/res/mods/index.js
@@ -1,21 +1,16 @@
/**
TaoLer社区修改 www.aieok.com
@Name: Fly社区主入口
- 2021-5.21
+ 2024-4.7
*/
-layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'imgcom'], function(exports){
+layui.define(['layer', 'form', 'util'], function(exports){
var $ = layui.jquery
,layer = layui.layer
- ,laytpl = layui.laytpl
,form = layui.form
- ,element = layui.element
- ,upload = layui.upload
,util = layui.util
- ,imgcom = layui.imgcom
,device = layui.device()
- ,DISABLED = 'layui-btn-disabled';
var uid = layui.cache.user.uid;
var login = $('.fly-nav-user').attr('userlogin');
@@ -93,522 +88,13 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'imgcom'],
,form: {}
- //简易编辑器
- ,layEditor: function(options){
- var html = [''
- ,''
- ,''
- ,''
- ,''
- ,''
- ,''
- ,''
- ,''
- ,'hr'
- ,''
- ,'
'].join('');
+ //简易编辑器 -移除 -2024/4/7
- var closeTips = function(){
- layer.close(mod.face.index);
- };
-
- var log = {}, mod = {
- //加粗
- strong: function(editor){
- var str = window.getSelection().toString();
- if(!str == ''){
- //var strB = ''+ str + '';
- layui.focusInsert(editor[0], '[strong]'+ str + '[/strong]');
- //console.log(str);
- // console.log(strB);
- }
- },
- face: function(editor, self){ //插入表情
- var str = '', ul, face = fly.faces;
- for(var key in face){
- str += '
';
- }
- str = '';
-
- layer.close(mod.face.index);
- mod.face.index = layer.tips(str, self, {
- tips: 3
- ,time: 0
- ,skin: 'layui-edit-face'
- ,tipsMore: true
- });
-
- $(document).off('click', closeTips).on('click', closeTips);
-
- $('#LAY-editface li').on('click', function(){
- var title = $(this).attr('title') + ' ';
- layui.focusInsert(editor[0], 'face' + title);
- editor.trigger('keyup');
- });
- }
- ,picture: function(editor){ //插入图片
- //判断登陆
- if(uid == -1){
- layer.msg('请登录再发图', {icon: 6}, function(){
- location.href = login;
- })
- return false;
- }
-
- layer.open({
- type: 1
- ,id: 'fly-jie-upload'
- ,title: '插入图片'
- ,area: 'auto'
- ,shade: false
- //,area: '465px'
- ,fixed: false
- ,offset: [
- editor.offset().top - $(window).scrollTop() + 'px'
- ,editor.offset().left + 'px'
- ]
- ,skin: 'layui-layer-border'
- ,content: [''].join('')
- ,success: function(layero, index){
- var image = layero.find('input[name="image"]');
-
- //执行上传实例
- upload.render({
- elem: '#uploadImg'
- ,accept: 'images'
- ,acceptMime: 'image/*'
- ,exts: 'jpg|png|gif|bmp|jpeg'
- ,url: uploads
- ,data: {type:'image'}
- ,auto: false
- //,bindAction: '#img-button' //指向一个按钮触发上传
- //,field: 'image'
- ,size: 10240
- ,choose: function (obj) { //选择文件后的回调
- imgcom.uploads(obj);
- }
- ,done: function(res){
- if(res.status == 0){
- //console.log(res.url);
- image.val(res.url);
- } else {
- layer.msg(res.msg, {icon: 5});
- }
- }
- ,error: function(){
- layer.msg('系统错误,请联系管理员');
- }
- });
-
- form.on('submit(uploadImages)', function(data){
- var field = data.field;
- if(!field.image) return image.focus();
- layui.focusInsert(editor[0], 'img['+ field.image + '] ');
- layer.close(index);
- editor.trigger('keyup');
- });
- }
- });
- }
- ,href: function(editor){ //超链接
- layer.prompt({
- title: '请输入合法链接'
- ,shade: false
- ,fixed: false
- ,id: 'LAY_flyedit_href'
- ,offset: [
- editor.offset().top - $(window).scrollTop() + 1 + 'px'
- ,editor.offset().left + 1 + 'px'
- ]
- }, function(val, index, elem){
- if(!/^http(s*):\/\/[\S]/.test(val)){
- layer.tips('请务必 http 或 https 开头', elem, {tips:1})
- return;
- }
- layui.focusInsert(editor[0], ' a('+ val +')['+ val + '] ');
- layer.close(index);
- editor.trigger('keyup');
- });
- }
- ,quote: function(editor){ //引用
- layer.prompt({
- title: '请输入引用内容'
- ,formType: 2
- ,maxlength: 10000
- ,shade: false
- ,id: 'LAY_flyedit_quote'
- ,offset: [
- editor.offset().top - $(window).scrollTop() + 1 + 'px'
- ,editor.offset().left + 1 + 'px'
- ]
- ,area: ['300px', '100px']
- }, function(val, index, elem){
- layui.focusInsert(editor[0], '[quote]\n '+ val + '\n[/quote]\n');
- layer.close(index);
- editor.trigger('keyup');
- });
- }
- ,code: function(editor){ //插入代码
- layer.prompt({
- title: '请贴入代码'
- ,formType: 2
- ,maxlength: 10000
- ,shade: false
- ,id: 'LAY_flyedit_code'
- ,area: ['800px', '360px']
- }, function(val, index, elem){
- layui.focusInsert(editor[0], '[pre]\n'+ val + '\n[/pre]\n');
- layer.close(index);
- editor.trigger('keyup');
- });
- }
- ,hr: function(editor){ //插入水平分割线
- layui.focusInsert(editor[0], '[hr]\n');
- editor.trigger('keyup');
- }
- ,video: function(editor){ //插入视频
- //判断登陆
- if(uid == -1){
- layer.msg('请登录再发视频', {icon: 6}, function(){
- location.href = login;
- })
- return false;
- }
- layer.open({
- type: 1
- ,id: 'fly-jie-video-upload'
- ,title: '插入视频'
- ,area: 'auto'
- ,shade: false
- //,area: '465px'
- ,fixed: false
- ,offset: [
- editor.offset().top - $(window).scrollTop() + 'px'
- ,editor.offset().left + 'px'
- ]
- ,skin: 'layui-layer-border'
- ,content: [''].join('')
- ,success: function(layero, index){
- var video = layero.find('input[name="video"]'), cover = layero.find('input[name="cover"]');
-
- //上传视频
- upload.render({
- url: uploads
- ,data: {type:'video'}
- ,accept: 'video'
- ,acceptMime: 'video/mp4'
- ,exts: 'mp4'
- ,elem: '#layedit-video'
- ,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
- layer.load(2); //上传loading
- }
- ,done: function(res){
- if(res.status == 0){
- video.val(res.url);
- } else {
- layer.msg(res.msg, {icon: 5});
- }
- layer.closeAll('loading');
- }
- });
- //上传图片
- upload.render({
- elem: '#video-img'
- ,accept: 'images'
- ,acceptMime: 'image/*'
- ,exts: 'jpg|png|gif|bmp|jpeg'
- ,url: uploads
- ,data: {type:'image'}
- ,auto: false
- //,bindAction: '#img-button' //指向一个按钮触发上传
- //,field: 'image'
- ,size: 10240
- ,choose: function (obj) { //选择文件后的回调
- imgcom.uploads(obj);
- }
- ,done: function(res){
- if(res.status == 0){
- cover.val(res.url);
- } else {
- layer.msg(res.msg, {icon: 5});
- }
- }
- ,error: function(){
- layer.msg('系统错误,请联系管理员');
- }
- });
- form.on('submit(uploadImages)', function(data){
- var field = data.field;
- if(!field.video) return video.focus();
- layui.focusInsert(editor[0], 'video('+field.cover+')['+ field.video + '] ');
- layer.close(index);
- });
- }
- });
- }
- ,audio: function(editor){ //插入音频
- //判断登陆
- if(uid == -1){
- layer.msg('请登录再发布', {icon: 6}, function(){
- location.href = login;
- })
- return false;
- }
- layer.open({
- type: 1
- ,id: 'fly-jie-audio-upload'
- ,title: '插入音频'
- ,area: 'auto'
- ,shade: false
- //,area: '465px'
- ,fixed: false
- ,offset: [
- editor.offset().top - $(window).scrollTop() + 'px'
- ,editor.offset().left + 'px'
- ]
- ,skin: 'layui-layer-border'
- ,content: [''].join('')
- ,success: function(layero, index){
- var loding,audio = layero.find('input[name="audio"]');
-
- upload.render({
- url: uploads
- ,data: {type:'audio'}
- ,elem: '#fly-jie-audio-upload .upload-audio'
- ,accept: 'audio'
- ,acceptMime: 'audio/*'
- ,exts: 'mp3|m4a'
- ,before: function(obj){
- //loding = layer.msg('文件上传中,请稍等哦', { icon: 16 ,shade:0.3,time:0 });
- layer.load(2); //上传loading
- }
- ,done: function(res){
-
- if(res.status == 0){
- audio.val(res.url);
- } else {
- layer.msg(res.msg, {icon: 5});
- }
- layer.closeAll('loading');
- }
- });
- form.on('submit(uploadImages)', function(data){
- var field = data.field;
- if(!field.audio) return audio.focus();
- layui.focusInsert(editor[0], 'audio['+ field.audio + '] ');
- layer.close(index);
- });
- }
- });
- }
- ,preview: function(editor, span){ //预览
- var othis = $(span), getContent = function(){
- var content = editor.val();
- return /^\{html\}/.test(content) ? content.replace(/^\{html\}/, '') : fly.content(content)
- }, isMobile = device.ios || device.android;
-
- if(mod.preview.isOpen) return layer.close(mod.preview.index);
-
- mod.preview.index = layer.open({
- type: 1
- ,title: '预览'
- ,shade: false
- ,offset: 'r'
- ,id: 'LAY_flyedit_preview'
- ,area: [
- isMobile ? '100%' : '775px'
- ,'100%'
- ]
- ,scrollbar: isMobile ? false : true
- ,anim: -1
- ,isOutAnim: false
- ,content: ''+ getContent() +'
'
- ,success: function(layero){
- editor.on('keyup', function(val){
- layero.find('.detail-body').html(getContent());
- });
- mod.preview.isOpen = true;
- othis.addClass('layui-this');
- }
- ,end: function(){
- delete mod.preview.isOpen;
- othis.removeClass('layui-this');
- }
- });
- }
-};
-
- layui.use('face', function(face){
- options = options || {};
- fly.faces = face;
- $(options.elem).each(function(index){
- var that = this, othis = $(that), parent = othis.parent();
- parent.prepend(html);
- parent.find('.fly-edit span').on('click', function(event){
- var type = $(this).attr('type');
- mod[type].call(that, othis, this);
- if(type === 'face'){
- event.stopPropagation()
- }
- });
- });
- });
-
- }
-
- ,escape: function(html){
- return String(html||'').replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&')
- .replace(//g, '>').replace(/'/g, ''').replace(/"/g, '"');
- }
-
- //内容转义
- ,content: function(content){
- var util = fly
- ,item = fly.faces;
-
- //支持的html标签
- var html = function(end){
- return new RegExp('\\n*\\|\\-'+ (end||'') +'(div|span|p|button|table|thead|th|tbody|tr|td|ul|li|ol|li|dl|dt|dd|h2|h3|h4|h5)([\\s\\S]*?)\\-\\|\\n*', 'g');
- };
-
-
- //XSS
- content = util.escape(content||'')
-
- //转义图片
- .replace(/img\[([^\s]+?)\]/g, function(img){
- return '';
- })
-
- //转义@
- .replace(/@(\S+)(\s+?|$)/g, '@$1$2')
-
- //转义表情
- .replace(/face\[([^\s\[\]]+?)\]/g, function(face){
- var alt = face.replace(/^face/g, '');
- return '
';
- })
-
- //转义脚本
- .replace(/a(\(javascript:)(.+)(;*\))/g, 'a(javascript:layer.msg(\'非法脚本\');)')
-
- //转义链接
- .replace(/a\([\s\S]+?\)\[[\s\S]*?\]/g, function(str){
- var href = (str.match(/a\(([\s\S]+?)\)\[/)||[])[1];
- var text = (str.match(/\)\[([\s\S]*?)\]/)||[])[1];
- if(!href) return str;
- var rel = /^(http(s)*:\/\/)\b(?!(\w+\.)*(sentsin.com|layui.com))\b/.test(href.replace(/\s/g, ''));
- return ''+ (text||href) +'';
- })
-
- //转义横线
- .replace(/\[hr\]\n*/g, '
')
-
- //转义表格
- .replace(/\[table\]([\s\S]*)\[\/table\]\n*/g, function(str){
- return str.replace(/\[(thead|th|tbody|tr|td)\]\n*/g, '<$1>')
- .replace(/\n*\[\/(thead|th|tbody|tr|td)\]\n*/g, '$1>')
-
- .replace(/\[table\]\n*/g, '')
- .replace(/\n*\[\/table\]\n*/g, '
');
- })
-
- //转义 div/span
- .replace(/\n*\[(div|span)([\s\S]*?)\]([\s\S]*?)\[\/(div|span)\]\n*/g, function(str){
- return str.replace(/\[(div|span)([\s\S]*?)\]\n*/g, '<$1 $2>')
- .replace(/\n*\[\/(div|span)\]\n*/g, '$1>');
- })
-
- //转义列表
- .replace(/\[ul\]([\s\S]*)\[\/ul\]\n*/g, function(str){
- return str.replace(/\[li\]\n*/g, '')
- .replace(/\n*\[\/li\]\n*/g, '')
-
- .replace(/\[ul\]\n*/g, '')
- .replace(/\n*\[\/ul\]\n*/g, '
');
- })
-
- //转义代码
- .replace(/\[pre\]([\s\S]*)\[\/pre\]\n*/g, function(str){
- return str.replace(/\[pre\]\n*/g, '')
- .replace(/\n*\[\/pre\]\n*/g, '
');
- })
-
- //转义引用
- .replace(/\[quote\]([\s\S]*)\[\/quote\]\n*/g, function(str){
- return str.replace(/\[quote\]\n*/g, '')
- .replace(/\n*\[\/quote\]\n*/g, '
');
- })
-
- //转义加粗
- .replace(/\[strong\]([\s\S]*)\[\/strong\]\n*/g, function(str){
- return str.replace(/\[strong\]\n*/g,'')
- .replace(/\n*\[\/strong\]\n*/g, '');
- })
-
- //转义换行
- .replace(/\n/g, '
')
-
- //转义视频
- .replace(/video\(.*?\)\[([^\s]+?)\]/g, function(str){
- var cover = (str.match(/video\(([\s\S]+?)\)\[/)||[])[1];
- var video = (str.match(/\)\[([^\s]+?)\]/)||[])[1];
- cover = cover ? cover : '/static/res/images/video_cover.jpg';
- return '';
- })
- //转义音频
- .replace(/audio\[([^\s]+?)\]/g, function(audio){
- return '';
- })
-
- return content;
- }
-
//新消息通知
,newmsg: function(){
var elemUser = $('.fly-nav-user');
- var messageNums = elemUser.attr('msg-url'),
- messageRead = elemUser.attr('readMsg-url');
+ var messageNums = elemUser.attr('msg-url');
+ var messageRead = elemUser.attr('readMsg-url');
if(uid != -1 && elemUser[0]){
fly.json(messageNums, {
_: new Date().getTime()
@@ -813,9 +299,7 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'imgcom'],
}
//加载编辑器
- // fly.layEditor({
- // elem: '.fly-editor'
- // });
+
//手机设备的简单适配 用户中心底部左侧栏导航
var treeMobile = $('.site-tree-mobile')
diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php
index 24f86d2..805d730 100644
--- a/vendor/composer/autoload_files.php
+++ b/vendor/composer/autoload_files.php
@@ -11,13 +11,11 @@ return array(
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
- 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
+ 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php',
'667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
- 'fe62ba7e10580d903cc46d808b5961a4' => $vendorDir . '/tightenco/collect/src/Collect/Support/helpers.php',
- 'caf31cc6ec7cf2241cb6f12c226c3846' => $vendorDir . '/tightenco/collect/src/Collect/Support/alias.php',
'6b998e7ad3182c0d21d23780badfa07b' => $vendorDir . '/yansongda/supports/src/Functions.php',
'b33e3d135e5d9e47d845c576147bda89' => $vendorDir . '/php-di/php-di/src/functions.php',
'223fa6f9b46fbe5d6b44c5ff847bfceb' => $vendorDir . '/taoser/think-addons/src/helper.php',
diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php
index a7b402e..29ab455 100644
--- a/vendor/composer/autoload_psr4.php
+++ b/vendor/composer/autoload_psr4.php
@@ -21,7 +21,6 @@ return array(
'Yansongda\\Supports\\' => array($vendorDir . '/yansongda/supports/src'),
'Yansongda\\Pay\\' => array($vendorDir . '/yansongda/pay/src'),
'Workerman\\' => array($vendorDir . '/workerman/workerman'),
- 'Tightenco\\Collect\\' => array($vendorDir . '/tightenco/collect/src/Collect'),
'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
'Symfony\\Polyfill\\Php72\\' => array($vendorDir . '/symfony/polyfill-php72'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php
index b974c2b..e5d50d4 100644
--- a/vendor/composer/autoload_static.php
+++ b/vendor/composer/autoload_static.php
@@ -12,13 +12,11 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
- 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
+ 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
'667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
- 'fe62ba7e10580d903cc46d808b5961a4' => __DIR__ . '/..' . '/tightenco/collect/src/Collect/Support/helpers.php',
- 'caf31cc6ec7cf2241cb6f12c226c3846' => __DIR__ . '/..' . '/tightenco/collect/src/Collect/Support/alias.php',
'6b998e7ad3182c0d21d23780badfa07b' => __DIR__ . '/..' . '/yansongda/supports/src/Functions.php',
'b33e3d135e5d9e47d845c576147bda89' => __DIR__ . '/..' . '/php-di/php-di/src/functions.php',
'223fa6f9b46fbe5d6b44c5ff847bfceb' => __DIR__ . '/..' . '/taoser/think-addons/src/helper.php',
@@ -61,10 +59,6 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2
array (
'Workerman\\' => 10,
),
- 'T' =>
- array (
- 'Tightenco\\Collect\\' => 18,
- ),
'S' =>
array (
'Symfony\\Polyfill\\Php80\\' => 23,
@@ -206,10 +200,6 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2
array (
0 => __DIR__ . '/..' . '/workerman/workerman',
),
- 'Tightenco\\Collect\\' =>
- array (
- 0 => __DIR__ . '/..' . '/tightenco/collect/src/Collect',
- ),
'Symfony\\Polyfill\\Php80\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-php80',
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index 21ad9ff..444eb68 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -847,17 +847,17 @@
},
{
"name": "jaeger/querylist",
- "version": "V4.2.8",
- "version_normalized": "4.2.8.0",
+ "version": "V4.2.9",
+ "version_normalized": "4.2.9.0",
"source": {
"type": "git",
"url": "https://github.com/jae-jae/QueryList.git",
- "reference": "39dc0ca9c668bec7a793e20472ccd7d26ef89ea4"
+ "reference": "7aae3aed38214d3d7096174faf49f6c41b2dd550"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/jae-jae/QueryList/zipball/39dc0ca9c668bec7a793e20472ccd7d26ef89ea4",
- "reference": "39dc0ca9c668bec7a793e20472ccd7d26ef89ea4",
+ "url": "https://api.github.com/repos/jae-jae/QueryList/zipball/7aae3aed38214d3d7096174faf49f6c41b2dd550",
+ "reference": "7aae3aed38214d3d7096174faf49f6c41b2dd550",
"shasum": ""
},
"require": {
@@ -865,13 +865,12 @@
"jaeger/g-http": "^1.1",
"jaeger/phpquery-single": "^1",
"php": ">=7.1",
- "tightenco/collect": ">5.0"
+ "symfony/var-dumper": ">3.4"
},
"require-dev": {
- "phpunit/phpunit": "^8.5",
- "symfony/var-dumper": "^3.3"
+ "phpunit/phpunit": "^8.5"
},
- "time": "2021-07-05T06:07:58+00:00",
+ "time": "2024-04-12T06:29:50+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -898,7 +897,7 @@
],
"support": {
"issues": "https://github.com/jae-jae/QueryList/issues",
- "source": "https://github.com/jae-jae/QueryList/tree/V4.2.8"
+ "source": "https://github.com/jae-jae/QueryList/tree/V4.2.9"
},
"funding": [
{
@@ -2578,69 +2577,6 @@
},
"install-path": "../taoser/think-setarr"
},
- {
- "name": "tightenco/collect",
- "version": "v8.83.27",
- "version_normalized": "8.83.27.0",
- "source": {
- "type": "git",
- "url": "https://github.com/tighten/collect.git",
- "reference": "07eed6cf7441c7a69c379fdcb118eec1a1fdd0e6"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/tighten/collect/zipball/07eed6cf7441c7a69c379fdcb118eec1a1fdd0e6",
- "reference": "07eed6cf7441c7a69c379fdcb118eec1a1fdd0e6",
- "shasum": "",
- "mirrors": [
- {
- "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
- "preferred": true
- }
- ]
- },
- "require": {
- "php": "^7.3|^8.0",
- "symfony/var-dumper": "^3.4 || ^4.0 || ^5.0 || ^6.0"
- },
- "require-dev": {
- "mockery/mockery": "^1.0",
- "nesbot/carbon": "^2.23.0",
- "phpunit/phpunit": "^8.3"
- },
- "time": "2023-01-13T18:05:42+00:00",
- "type": "library",
- "installation-source": "dist",
- "autoload": {
- "files": [
- "src/Collect/Support/helpers.php",
- "src/Collect/Support/alias.php"
- ],
- "psr-4": {
- "Tightenco\\Collect\\": "src/Collect"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Taylor Otwell",
- "email": "taylorotwell@gmail.com"
- }
- ],
- "description": "Collect - Illuminate Collections as a separate package.",
- "keywords": [
- "collection",
- "laravel"
- ],
- "support": {
- "issues": "https://github.com/tighten/collect/issues",
- "source": "https://github.com/tighten/collect/tree/v8.83.27"
- },
- "install-path": "../tightenco/collect"
- },
{
"name": "topthink/framework",
"version": "v6.1.4",
diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php
index ac1fbfd..20a1d3e 100644
--- a/vendor/composer/installed.php
+++ b/vendor/composer/installed.php
@@ -3,7 +3,7 @@
'name' => 'taoser/taoler',
'pretty_version' => '2.3.10.x-dev',
'version' => '2.3.10.9999999-dev',
- 'reference' => '2e95b716720018a27230c873200926631e74e781',
+ 'reference' => '158340e85a56ec3bd70563cef0bf1491468d7370',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -119,9 +119,9 @@
'dev_requirement' => false,
),
'jaeger/querylist' => array(
- 'pretty_version' => 'V4.2.8',
- 'version' => '4.2.8.0',
- 'reference' => '39dc0ca9c668bec7a793e20472ccd7d26ef89ea4',
+ 'pretty_version' => 'V4.2.9',
+ 'version' => '4.2.9.0',
+ 'reference' => '7aae3aed38214d3d7096174faf49f6c41b2dd550',
'type' => 'library',
'install_path' => __DIR__ . '/../jaeger/querylist',
'aliases' => array(),
@@ -358,7 +358,7 @@
'taoser/taoler' => array(
'pretty_version' => '2.3.10.x-dev',
'version' => '2.3.10.9999999-dev',
- 'reference' => '2e95b716720018a27230c873200926631e74e781',
+ 'reference' => '158340e85a56ec3bd70563cef0bf1491468d7370',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -391,15 +391,6 @@
'aliases' => array(),
'dev_requirement' => false,
),
- 'tightenco/collect' => array(
- 'pretty_version' => 'v8.83.27',
- 'version' => '8.83.27.0',
- 'reference' => '07eed6cf7441c7a69c379fdcb118eec1a1fdd0e6',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../tightenco/collect',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
'topthink/framework' => array(
'pretty_version' => 'v6.1.4',
'version' => '6.1.4.0',
diff --git a/vendor/jaeger/querylist/.github/FUNDING.yml b/vendor/jaeger/querylist/.github/FUNDING.yml
deleted file mode 100644
index c53fd16..0000000
--- a/vendor/jaeger/querylist/.github/FUNDING.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-# These are supported funding model platforms
-
-github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
-patreon: # Replace with a single Patreon username
-open_collective: querylist # Replace with a single Open Collective username
-ko_fi: # Replace with a single Ko-fi username
-tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
-community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
-liberapay: # Replace with a single Liberapay username
-issuehunt: # Replace with a single IssueHunt username
-otechie: # Replace with a single Otechie username
-custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
diff --git a/vendor/jaeger/querylist/.gitignore b/vendor/jaeger/querylist/.gitignore
deleted file mode 100644
index e2ee195..0000000
--- a/vendor/jaeger/querylist/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/vendor/
-.idea/
-composer.lock
-.DS_Store
-*.cache
\ No newline at end of file
diff --git a/vendor/jaeger/querylist/composer.json b/vendor/jaeger/querylist/composer.json
index e1bcefe..19cb6b9 100644
--- a/vendor/jaeger/querylist/composer.json
+++ b/vendor/jaeger/querylist/composer.json
@@ -8,7 +8,7 @@
"jaeger/phpquery-single": "^1",
"jaeger/g-http": "^1.1",
"ext-dom": "*",
- "tightenco/collect": ">5.0"
+ "symfony/var-dumper": ">3.4"
},
"suggest":{
@@ -26,12 +26,15 @@
}
},
"autoload-dev": {
+ "files": [
+ "src/Collect/Support/helpers.php",
+ "src/Collect/Support/alias.php"
+ ],
"psr-4": {
"Tests\\": "tests/"
}
},
"require-dev": {
- "symfony/var-dumper": "^3.3",
"phpunit/phpunit": "^8.5"
},
"scripts": {
diff --git a/vendor/jaeger/querylist/phpunit.xml b/vendor/jaeger/querylist/phpunit.xml
deleted file mode 100644
index ba72a84..0000000
--- a/vendor/jaeger/querylist/phpunit.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
- ./tests
-
-
-
-
-
- src
-
-
-
-
\ No newline at end of file
diff --git a/vendor/jaeger/querylist/src/Collect/Conditionable/HigherOrderWhenProxy.php b/vendor/jaeger/querylist/src/Collect/Conditionable/HigherOrderWhenProxy.php
new file mode 100644
index 0000000..96ea367
--- /dev/null
+++ b/vendor/jaeger/querylist/src/Collect/Conditionable/HigherOrderWhenProxy.php
@@ -0,0 +1,109 @@
+target = $target;
+ }
+
+ /**
+ * Set the condition on the proxy.
+ *
+ * @param bool $condition
+ * @return $this
+ */
+ public function condition($condition)
+ {
+ [$this->condition, $this->hasCondition] = [$condition, true];
+
+ return $this;
+ }
+
+ /**
+ * Indicate that the condition should be negated.
+ *
+ * @return $this
+ */
+ public function negateConditionOnCapture()
+ {
+ $this->negateConditionOnCapture = true;
+
+ return $this;
+ }
+
+ /**
+ * Proxy accessing an attribute onto the target.
+ *
+ * @param string $key
+ * @return mixed
+ */
+ public function __get($key)
+ {
+ if (! $this->hasCondition) {
+ $condition = $this->target->{$key};
+
+ return $this->condition($this->negateConditionOnCapture ? ! $condition : $condition);
+ }
+
+ return $this->condition
+ ? $this->target->{$key}
+ : $this->target;
+ }
+
+ /**
+ * Proxy a method call on the target.
+ *
+ * @param string $method
+ * @param array $parameters
+ * @return mixed
+ */
+ public function __call($method, $parameters)
+ {
+ if (! $this->hasCondition) {
+ $condition = $this->target->{$method}(...$parameters);
+
+ return $this->condition($this->negateConditionOnCapture ? ! $condition : $condition);
+ }
+
+ return $this->condition
+ ? $this->target->{$method}(...$parameters)
+ : $this->target;
+ }
+}
diff --git a/vendor/jaeger/querylist/src/Collect/Contracts/Support/Arrayable.php b/vendor/jaeger/querylist/src/Collect/Contracts/Support/Arrayable.php
new file mode 100644
index 0000000..bcf60e2
--- /dev/null
+++ b/vendor/jaeger/querylist/src/Collect/Contracts/Support/Arrayable.php
@@ -0,0 +1,17 @@
+
+ */
+ public function toArray();
+}
diff --git a/vendor/tightenco/collect/src/Collect/Contracts/Support/CanBeEscapedWhenCastToString.php b/vendor/jaeger/querylist/src/Collect/Contracts/Support/CanBeEscapedWhenCastToString.php
similarity index 86%
rename from vendor/tightenco/collect/src/Collect/Contracts/Support/CanBeEscapedWhenCastToString.php
rename to vendor/jaeger/querylist/src/Collect/Contracts/Support/CanBeEscapedWhenCastToString.php
index 6f3ba00..699993b 100644
--- a/vendor/tightenco/collect/src/Collect/Contracts/Support/CanBeEscapedWhenCastToString.php
+++ b/vendor/jaeger/querylist/src/Collect/Contracts/Support/CanBeEscapedWhenCastToString.php
@@ -1,6 +1,6 @@
offsetExists($key);
}
+ if (is_float($key)) {
+ $key = (string) $key;
+ }
+
return array_key_exists($key, $array);
}
@@ -252,7 +257,7 @@ class Arr
* Remove one or many array items from a given array using "dot" notation.
*
* @param array $array
- * @param array|string $keys
+ * @param array|string|int|float $keys
* @return void
*/
public static function forget(&$array, $keys)
@@ -281,7 +286,7 @@ class Arr
while (count($parts) > 1) {
$part = array_shift($parts);
- if (isset($array[$part]) && is_array($array[$part])) {
+ if (isset($array[$part]) && static::accessible($array[$part])) {
$array = &$array[$part];
} else {
continue 2;
@@ -314,7 +319,7 @@ class Arr
return $array[$key];
}
- if (strpos($key, '.') === false) {
+ if (! str_contains($key, '.')) {
return $array[$key] ?? value($default);
}
@@ -423,6 +428,59 @@ class Arr
return ! self::isAssoc($array);
}
+ /**
+ * Join all items using a string. The final items can use a separate glue string.
+ *
+ * @param array $array
+ * @param string $glue
+ * @param string $finalGlue
+ * @return string
+ */
+ public static function join($array, $glue, $finalGlue = '')
+ {
+ if ($finalGlue === '') {
+ return implode($glue, $array);
+ }
+
+ if (count($array) === 0) {
+ return '';
+ }
+
+ if (count($array) === 1) {
+ return end($array);
+ }
+
+ $finalItem = array_pop($array);
+
+ return implode($glue, $array).$finalGlue.$finalItem;
+ }
+
+ /**
+ * Key an associative array by a field or using a callback.
+ *
+ * @param array $array
+ * @param callable|array|string $keyBy
+ * @return array
+ */
+ public static function keyBy($array, $keyBy)
+ {
+ return Collection::make($array)->keyBy($keyBy)->all();
+ }
+
+ /**
+ * Prepend the key names of an associative array.
+ *
+ * @param array $array
+ * @param string $prependWith
+ * @return array
+ */
+ public static function prependKeysWith($array, $prependWith)
+ {
+ return Collection::make($array)->mapWithKeys(function ($item, $key) use ($prependWith) {
+ return [$prependWith.$key => $item];
+ })->all();
+ }
+
/**
* Get a subset of the items from the given array.
*
@@ -487,6 +545,26 @@ class Arr
return [$value, $key];
}
+ /**
+ * Run a map over each of the items in the array.
+ *
+ * @param array $array
+ * @param callable $callback
+ * @return array
+ */
+ public static function map(array $array, callable $callback)
+ {
+ $keys = array_keys($array);
+
+ try {
+ $items = array_map($callback, $array, $keys);
+ } catch (ArgumentCountError) {
+ $items = array_map($callback, $array);
+ }
+
+ return array_combine($keys, $items);
+ }
+
/**
* Push an item onto the beginning of an array.
*
@@ -539,7 +617,7 @@ class Arr
*
* @param array $array
* @param int|null $number
- * @param bool|false $preserveKeys
+ * @param bool $preserveKeys
* @return mixed
*
* @throws \InvalidArgumentException
@@ -587,7 +665,7 @@ class Arr
* If no key is given to the method, the entire array will be replaced.
*
* @param array $array
- * @param string|null $key
+ * @param string|int|null $key
* @param mixed $value
* @return array
*/
@@ -653,6 +731,18 @@ class Arr
return Collection::make($array)->sortBy($callback)->all();
}
+ /**
+ * Sort the array in descending order using the given callback or "dot" notation.
+ *
+ * @param array $array
+ * @param callable|array|string|null $callback
+ * @return array
+ */
+ public static function sortDesc($array, $callback = null)
+ {
+ return Collection::make($array)->sortByDesc($callback)->all();
+ }
+
/**
* Recursively sort an array by keys and values.
*
@@ -705,6 +795,29 @@ class Arr
return implode(' ', $classes);
}
+ /**
+ * Conditionally compile styles from an array into a style list.
+ *
+ * @param array $array
+ * @return string
+ */
+ public static function toCssStyles($array)
+ {
+ $styleList = static::wrap($array);
+
+ $styles = [];
+
+ foreach ($styleList as $class => $constraint) {
+ if (is_numeric($class)) {
+ $styles[] = Str::finish($constraint, ';');
+ } elseif ($constraint) {
+ $styles[] = Str::finish($class, ';');
+ }
+ }
+
+ return implode(' ', $styles);
+ }
+
/**
* Filter the array using the given callback.
*
@@ -725,9 +838,7 @@ class Arr
*/
public static function whereNotNull($array)
{
- return static::where($array, function ($value) {
- return ! is_null($value);
- });
+ return static::where($array, fn ($value) => ! is_null($value));
}
/**
diff --git a/vendor/tightenco/collect/src/Collect/Support/Collection.php b/vendor/jaeger/querylist/src/Collect/Support/Collection.php
similarity index 73%
rename from vendor/tightenco/collect/src/Collect/Support/Collection.php
rename to vendor/jaeger/querylist/src/Collect/Support/Collection.php
index 0dc7323..34457a2 100644
--- a/vendor/tightenco/collect/src/Collect/Support/Collection.php
+++ b/vendor/jaeger/querylist/src/Collect/Support/Collection.php
@@ -1,29 +1,40 @@
+ * @implements \QL\Collect\Support\Enumerable
+ */
class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerable
{
+ /**
+ * @use \QL\Collect\Support\Traits\EnumeratesValues
+ */
use EnumeratesValues, Macroable;
/**
* The items contained in the collection.
*
- * @var array
+ * @var array
*/
protected $items = [];
/**
* Create a new collection.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable|null $items
* @return void
*/
public function __construct($items = [])
@@ -36,7 +47,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
*
* @param int $from
* @param int $to
- * @return static
+ * @return static
*/
public static function range($from, $to)
{
@@ -46,7 +57,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get all of the items in the collection.
*
- * @return array
+ * @return array
*/
public function all()
{
@@ -56,7 +67,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get a lazy collection for the items in this collection.
*
- * @return \Tightenco\Collect\Support\LazyCollection
+ * @return \QL\Collect\Support\LazyCollection
*/
public function lazy()
{
@@ -66,18 +77,16 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get the average value of a given key.
*
- * @param callable|string|null $callback
- * @return mixed
+ * @param (callable(TValue): float|int)|string|null $callback
+ * @return float|int|null
*/
public function avg($callback = null)
{
$callback = $this->valueRetriever($callback);
- $items = $this->map(function ($value) use ($callback) {
- return $callback($value);
- })->filter(function ($value) {
- return ! is_null($value);
- });
+ $items = $this
+ ->map(fn ($value) => $callback($value))
+ ->filter(fn ($value) => ! is_null($value));
if ($count = $items->count()) {
return $items->sum() / $count;
@@ -87,15 +96,14 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get the median of a given key.
*
- * @param string|array|null $key
- * @return mixed
+ * @param string|array|null $key
+ * @return float|int|null
*/
public function median($key = null)
{
$values = (isset($key) ? $this->pluck($key) : $this)
- ->filter(function ($item) {
- return ! is_null($item);
- })->sort()->values();
+ ->filter(fn ($item) => ! is_null($item))
+ ->sort()->values();
$count = $values->count();
@@ -117,8 +125,8 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get the mode of a given key.
*
- * @param string|array|null $key
- * @return array|null
+ * @param string|array|null $key
+ * @return array|null
*/
public function mode($key = null)
{
@@ -130,23 +138,20 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
$counts = new static;
- $collection->each(function ($value) use ($counts) {
- $counts[$value] = isset($counts[$value]) ? $counts[$value] + 1 : 1;
- });
+ $collection->each(fn ($value) => $counts[$value] = isset($counts[$value]) ? $counts[$value] + 1 : 1);
$sorted = $counts->sort();
$highestValue = $sorted->last();
- return $sorted->filter(function ($value) use ($highestValue) {
- return $value == $highestValue;
- })->sort()->keys()->all();
+ return $sorted->filter(fn ($value) => $value == $highestValue)
+ ->sort()->keys()->all();
}
/**
* Collapse the collection of items into a single array.
*
- * @return static
+ * @return static
*/
public function collapse()
{
@@ -156,7 +161,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Determine if an item exists in the collection.
*
- * @param mixed $key
+ * @param (callable(TValue, TKey): bool)|TValue|string $key
* @param mixed $operator
* @param mixed $value
* @return bool
@@ -176,6 +181,26 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
return $this->contains($this->operatorForWhere(...func_get_args()));
}
+ /**
+ * Determine if an item exists, using strict comparison.
+ *
+ * @param (callable(TValue): bool)|TValue|array-key $key
+ * @param TValue|null $value
+ * @return bool
+ */
+ public function containsStrict($key, $value = null)
+ {
+ if (func_num_args() === 2) {
+ return $this->contains(fn ($item) => data_get($item, $key) === $value);
+ }
+
+ if ($this->useAsCallable($key)) {
+ return ! is_null($this->first($key));
+ }
+
+ return in_array($key, $this->items, true);
+ }
+
/**
* Determine if an item is not contained in the collection.
*
@@ -192,8 +217,11 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Cross join with the given lists, returning all possible permutations.
*
- * @param mixed ...$lists
- * @return static
+ * @template TCrossJoinKey
+ * @template TCrossJoinValue
+ *
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable ...$lists
+ * @return static>
*/
public function crossJoin(...$lists)
{
@@ -205,7 +233,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get the items in the collection that are not present in the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function diff($items)
@@ -216,8 +244,8 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get the items in the collection that are not present in the given items, using the callback.
*
- * @param mixed $items
- * @param callable $callback
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
+ * @param callable(TValue, TValue): int $callback
* @return static
*/
public function diffUsing($items, callable $callback)
@@ -228,7 +256,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get the items in the collection whose keys and values are not present in the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function diffAssoc($items)
@@ -239,8 +267,8 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get the items in the collection whose keys and values are not present in the given items, using the callback.
*
- * @param mixed $items
- * @param callable $callback
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
+ * @param callable(TKey, TKey): int $callback
* @return static
*/
public function diffAssocUsing($items, callable $callback)
@@ -251,7 +279,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get the items in the collection whose keys are not present in the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function diffKeys($items)
@@ -262,8 +290,8 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get the items in the collection whose keys are not present in the given items, using the callback.
*
- * @param mixed $items
- * @param callable $callback
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
+ * @param callable(TKey, TKey): int $callback
* @return static
*/
public function diffKeysUsing($items, callable $callback)
@@ -274,7 +302,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Retrieve duplicate items from the collection.
*
- * @param callable|string|null $callback
+ * @param (callable(TValue): bool)|string|null $callback
* @param bool $strict
* @return static
*/
@@ -302,7 +330,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Retrieve duplicate items from the collection using strict comparison.
*
- * @param callable|string|null $callback
+ * @param (callable(TValue): bool)|string|null $callback
* @return static
*/
public function duplicatesStrict($callback = null)
@@ -314,25 +342,21 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
* Get the comparison function to detect duplicates.
*
* @param bool $strict
- * @return \Closure
+ * @return callable(TValue, TValue): bool
*/
protected function duplicateComparator($strict)
{
if ($strict) {
- return function ($a, $b) {
- return $a === $b;
- };
+ return fn ($a, $b) => $a === $b;
}
- return function ($a, $b) {
- return $a == $b;
- };
+ return fn ($a, $b) => $a == $b;
}
/**
* Get all items except for those with the specified keys.
*
- * @param \Tightenco\Collect\Support\Collection|mixed $keys
+ * @param \QL\Collect\Support\Enumerable|array $keys
* @return static
*/
public function except($keys)
@@ -349,7 +373,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Run a filter over each of the items.
*
- * @param callable|null $callback
+ * @param (callable(TValue, TKey): bool)|null $callback
* @return static
*/
public function filter(callable $callback = null)
@@ -364,9 +388,11 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get the first item from the collection passing the given truth test.
*
- * @param callable|null $callback
- * @param mixed $default
- * @return mixed
+ * @template TFirstDefault
+ *
+ * @param (callable(TValue, TKey): bool)|null $callback
+ * @param TFirstDefault|(\Closure(): TFirstDefault) $default
+ * @return TValue|TFirstDefault
*/
public function first(callable $callback = null, $default = null)
{
@@ -377,7 +403,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
* Get a flattened array of the items in the collection.
*
* @param int $depth
- * @return static
+ * @return static
*/
public function flatten($depth = INF)
{
@@ -387,7 +413,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Flip the items in the collection.
*
- * @return static
+ * @return static
*/
public function flip()
{
@@ -397,7 +423,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Remove an item from the collection by key.
*
- * @param string|int|array $keys
+ * @param TKey|array $keys
* @return $this
*/
public function forget($keys)
@@ -412,9 +438,11 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get an item from the collection by key.
*
- * @param mixed $key
- * @param mixed $default
- * @return mixed
+ * @template TGetDefault
+ *
+ * @param TKey $key
+ * @param TGetDefault|(\Closure(): TGetDefault) $default
+ * @return TValue|TGetDefault
*/
public function get($key, $default = null)
{
@@ -446,9 +474,9 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Group an associative array by a field or using a callback.
*
- * @param array|callable|string $groupBy
+ * @param (callable(TValue, TKey): array-key)|array|string $groupBy
* @param bool $preserveKeys
- * @return static
+ * @return static>
*/
public function groupBy($groupBy, $preserveKeys = false)
{
@@ -470,7 +498,11 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
}
foreach ($groupKeys as $groupKey) {
- $groupKey = is_bool($groupKey) ? (int) $groupKey : $groupKey;
+ $groupKey = match (true) {
+ is_bool($groupKey) => (int) $groupKey,
+ $groupKey instanceof \Stringable => (string) $groupKey,
+ default => $groupKey,
+ };
if (! array_key_exists($groupKey, $results)) {
$results[$groupKey] = new static;
@@ -492,8 +524,8 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Key an associative array by a field or using a callback.
*
- * @param callable|string $keyBy
- * @return static
+ * @param (callable(TValue, TKey): array-key)|array|string $keyBy
+ * @return static
*/
public function keyBy($keyBy)
{
@@ -517,7 +549,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Determine if an item exists in the collection by key.
*
- * @param mixed $key
+ * @param TKey|array $key
* @return bool
*/
public function has($key)
@@ -559,12 +591,16 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Concatenate values of a given key as a string.
*
- * @param string $value
+ * @param callable|string $value
* @param string|null $glue
* @return string
*/
public function implode($value, $glue = null)
{
+ if ($this->useAsCallable($value)) {
+ return implode($glue ?? '', $this->map($value)->all());
+ }
+
$first = $this->first();
if (is_array($first) || (is_object($first) && ! $first instanceof \Illuminate\Support\Stringable)) {
@@ -577,7 +613,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Intersect the collection with the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function intersect($items)
@@ -585,10 +621,45 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
return new static(array_intersect($this->items, $this->getArrayableItems($items)));
}
+ /**
+ * Intersect the collection with the given items, using the callback.
+ *
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
+ * @param callable(TValue, TValue): int $callback
+ * @return static
+ */
+ public function intersectUsing($items, callable $callback)
+ {
+ return new static(array_uintersect($this->items, $this->getArrayableItems($items), $callback));
+ }
+
+ /**
+ * Intersect the collection with the given items with additional index check.
+ *
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
+ * @return static
+ */
+ public function intersectAssoc($items)
+ {
+ return new static(array_intersect_assoc($this->items, $this->getArrayableItems($items)));
+ }
+
+ /**
+ * Intersect the collection with the given items with additional index check, using the callback.
+ *
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
+ * @param callable(TValue, TValue): int $callback
+ * @return static
+ */
+ public function intersectAssocUsing($items, callable $callback)
+ {
+ return new static(array_intersect_uassoc($this->items, $this->getArrayableItems($items), $callback));
+ }
+
/**
* Intersect the collection with the given items by key.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function intersectByKeys($items)
@@ -651,7 +722,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get the keys of the collection items.
*
- * @return static
+ * @return static
*/
public function keys()
{
@@ -661,9 +732,11 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get the last item from the collection.
*
- * @param callable|null $callback
- * @param mixed $default
- * @return mixed
+ * @template TLastDefault
+ *
+ * @param (callable(TValue, TKey): bool)|null $callback
+ * @param TLastDefault|(\Closure(): TLastDefault) $default
+ * @return TValue|TLastDefault
*/
public function last(callable $callback = null, $default = null)
{
@@ -673,9 +746,9 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get the values of a given key.
*
- * @param string|array|int|null $value
+ * @param string|int|array $value
* @param string|null $key
- * @return static
+ * @return static
*/
public function pluck($value, $key = null)
{
@@ -685,16 +758,14 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Run a map over each of the items.
*
- * @param callable $callback
- * @return static
+ * @template TMapValue
+ *
+ * @param callable(TValue, TKey): TMapValue $callback
+ * @return static
*/
public function map(callable $callback)
{
- $keys = array_keys($this->items);
-
- $items = array_map($callback, $this->items, $keys);
-
- return new static(array_combine($keys, $items));
+ return new static(Arr::map($this->items, $callback));
}
/**
@@ -702,8 +773,11 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
*
* The callback should return an associative array with a single key/value pair.
*
- * @param callable $callback
- * @return static
+ * @template TMapToDictionaryKey of array-key
+ * @template TMapToDictionaryValue
+ *
+ * @param callable(TValue, TKey): array $callback
+ * @return static>
*/
public function mapToDictionary(callable $callback)
{
@@ -731,8 +805,11 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
*
* The callback should return an associative array with a single key/value pair.
*
- * @param callable $callback
- * @return static
+ * @template TMapWithKeysKey of array-key
+ * @template TMapWithKeysValue
+ *
+ * @param callable(TValue, TKey): array $callback
+ * @return static
*/
public function mapWithKeys(callable $callback)
{
@@ -752,7 +829,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Merge the collection with the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function merge($items)
@@ -763,8 +840,10 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Recursively merge the collection with the given items.
*
- * @param mixed $items
- * @return static
+ * @template TMergeRecursiveValue
+ *
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
+ * @return static
*/
public function mergeRecursive($items)
{
@@ -774,8 +853,10 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Create a collection by using this collection for keys and another for its values.
*
- * @param mixed $values
- * @return static
+ * @template TCombineValue
+ *
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $values
+ * @return static
*/
public function combine($values)
{
@@ -785,7 +866,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Union the collection with the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function union($items)
@@ -820,7 +901,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get the items with the specified keys.
*
- * @param mixed $keys
+ * @param \QL\Collect\Support\Enumerable|array|string|null $keys
* @return static
*/
public function only($keys)
@@ -842,7 +923,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
* Get and remove the last N items from the collection.
*
* @param int $count
- * @return mixed
+ * @return static|TValue|null
*/
public function pop($count = 1)
{
@@ -868,8 +949,8 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Push an item onto the beginning of the collection.
*
- * @param mixed $value
- * @param mixed $key
+ * @param TValue $value
+ * @param TKey $key
* @return $this
*/
public function prepend($value, $key = null)
@@ -882,7 +963,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Push one or more items onto the end of the collection.
*
- * @param mixed $values
+ * @param TValue ...$values
* @return $this
*/
public function push(...$values)
@@ -897,7 +978,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Push all of the given items onto the collection.
*
- * @param iterable $source
+ * @param iterable $source
* @return static
*/
public function concat($source)
@@ -914,9 +995,11 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get and remove an item from the collection.
*
- * @param mixed $key
- * @param mixed $default
- * @return mixed
+ * @template TPullDefault
+ *
+ * @param TKey $key
+ * @param TPullDefault|(\Closure(): TPullDefault) $default
+ * @return TValue|TPullDefault
*/
public function pull($key, $default = null)
{
@@ -926,8 +1009,8 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Put an item in the collection by key.
*
- * @param mixed $key
- * @param mixed $value
+ * @param TKey $key
+ * @param TValue $value
* @return $this
*/
public function put($key, $value)
@@ -940,8 +1023,8 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get one or a specified number of items randomly from the collection.
*
- * @param int|null $number
- * @return static|mixed
+ * @param (callable(self): int)|int|null $number
+ * @return static|TValue
*
* @throws \InvalidArgumentException
*/
@@ -951,13 +1034,17 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
return Arr::random($this->items);
}
+ if (is_callable($number)) {
+ return new static(Arr::random($this->items, $number($this)));
+ }
+
return new static(Arr::random($this->items, $number));
}
/**
* Replace the collection items with the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function replace($items)
@@ -968,7 +1055,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Recursively replace the collection items with the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function replaceRecursive($items)
@@ -989,9 +1076,9 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Search the collection for a given value and return the corresponding key if successful.
*
- * @param mixed $value
+ * @param TValue|(callable(TValue,TKey): bool) $value
* @param bool $strict
- * @return mixed
+ * @return TKey|bool
*/
public function search($value, $strict = false)
{
@@ -1012,7 +1099,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
* Get and remove the first N items from the collection.
*
* @param int $count
- * @return mixed
+ * @return static|TValue|null
*/
public function shift($count = 1)
{
@@ -1051,7 +1138,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
*
* @param int $size
* @param int $step
- * @return static
+ * @return static
*/
public function sliding($size = 2, $step = 1)
{
@@ -1076,7 +1163,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Skip items in the collection until the given condition is met.
*
- * @param mixed $value
+ * @param TValue|callable(TValue,TKey): bool $value
* @return static
*/
public function skipUntil($value)
@@ -1087,7 +1174,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Skip items in the collection while the given condition is met.
*
- * @param mixed $value
+ * @param TValue|callable(TValue,TKey): bool $value
* @return static
*/
public function skipWhile($value)
@@ -1111,7 +1198,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
* Split a collection into a certain number of groups.
*
* @param int $numberOfGroups
- * @return static
+ * @return static
*/
public function split($numberOfGroups)
{
@@ -1148,7 +1235,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
* Split a collection into a certain number of groups, and fill the first groups completely.
*
* @param int $numberOfGroups
- * @return static
+ * @return static
*/
public function splitIn($numberOfGroups)
{
@@ -1158,13 +1245,13 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get the first item in the collection, but only if exactly one item exists. Otherwise, throw an exception.
*
- * @param mixed $key
+ * @param (callable(TValue, TKey): bool)|string $key
* @param mixed $operator
* @param mixed $value
- * @return mixed
+ * @return TValue
*
- * @throws \Tightenco\Collect\Support\ItemNotFoundException
- * @throws \Tightenco\Collect\Support\MultipleItemsFoundException
+ * @throws \QL\Collect\Support\ItemNotFoundException
+ * @throws \QL\Collect\Support\MultipleItemsFoundException
*/
public function sole($key = null, $operator = null, $value = null)
{
@@ -1172,14 +1259,16 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
? $this->operatorForWhere(...func_get_args())
: $key;
- $items = $this->when($filter)->filter($filter);
+ $items = $this->unless($filter == null)->filter($filter);
- if ($items->isEmpty()) {
+ $count = $items->count();
+
+ if ($count === 0) {
throw new ItemNotFoundException;
}
- if ($items->count() > 1) {
- throw new MultipleItemsFoundException;
+ if ($count > 1) {
+ throw new MultipleItemsFoundException($count);
}
return $items->first();
@@ -1188,12 +1277,12 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get the first item in the collection but throw an exception if no matching items exist.
*
- * @param mixed $key
+ * @param (callable(TValue, TKey): bool)|string $key
* @param mixed $operator
* @param mixed $value
- * @return mixed
+ * @return TValue
*
- * @throws \Tightenco\Collect\Support\ItemNotFoundException
+ * @throws \QL\Collect\Support\ItemNotFoundException
*/
public function firstOrFail($key = null, $operator = null, $value = null)
{
@@ -1216,7 +1305,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
* Chunk the collection into chunks of the given size.
*
* @param int $size
- * @return static
+ * @return static
*/
public function chunk($size)
{
@@ -1236,8 +1325,8 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Chunk the collection into chunks with a callback.
*
- * @param callable $callback
- * @return static
+ * @param callable(TValue, TKey, static): bool $callback
+ * @return static>
*/
public function chunkWhile(callable $callback)
{
@@ -1249,7 +1338,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Sort through each item with a callback.
*
- * @param callable|int|null $callback
+ * @param (callable(TValue, TValue): int)|null|int $callback
* @return static
*/
public function sort($callback = null)
@@ -1281,7 +1370,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Sort the collection using the given callback.
*
- * @param callable|array|string $callback
+ * @param array|(callable(TValue, TKey): mixed)|string $callback
* @param int $options
* @param bool $descending
* @return static
@@ -1319,14 +1408,14 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Sort the collection using multiple comparisons.
*
- * @param array $comparisons
+ * @param array $comparisons
* @return static
*/
protected function sortByMany(array $comparisons = [])
{
$items = $this->items;
- usort($items, function ($a, $b) use ($comparisons) {
+ uasort($items, function ($a, $b) use ($comparisons) {
foreach ($comparisons as $comparison) {
$comparison = Arr::wrap($comparison);
@@ -1335,8 +1424,6 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
$ascending = Arr::get($comparison, 1, true) === true ||
Arr::get($comparison, 1, true) === 'asc';
- $result = 0;
-
if (! is_string($prop) && is_callable($prop)) {
$result = $prop($a, $b);
} else {
@@ -1363,7 +1450,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Sort the collection in descending order using the given callback.
*
- * @param callable|string $callback
+ * @param array|(callable(TValue, TKey): mixed)|string $callback
* @param int $options
* @return static
*/
@@ -1402,7 +1489,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Sort the collection keys using a callback.
*
- * @param callable $callback
+ * @param callable(TKey, TKey): int $callback
* @return static
*/
public function sortKeysUsing(callable $callback)
@@ -1419,7 +1506,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
*
* @param int $offset
* @param int|null $length
- * @param mixed $replacement
+ * @param array $replacement
* @return static
*/
public function splice($offset, $length = null, $replacement = [])
@@ -1449,7 +1536,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Take items in the collection until the given condition is met.
*
- * @param mixed $value
+ * @param TValue|callable(TValue,TKey): bool $value
* @return static
*/
public function takeUntil($value)
@@ -1460,7 +1547,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Take items in the collection while the given condition is met.
*
- * @param mixed $value
+ * @param TValue|callable(TValue,TKey): bool $value
* @return static
*/
public function takeWhile($value)
@@ -1471,7 +1558,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Transform each item in the collection using a callback.
*
- * @param callable $callback
+ * @param callable(TValue, TKey): TValue $callback
* @return $this
*/
public function transform(callable $callback)
@@ -1494,7 +1581,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Return only unique items from the collection array.
*
- * @param string|callable|null $key
+ * @param (callable(TValue, TKey): mixed)|string|null $key
* @param bool $strict
* @return static
*/
@@ -1520,7 +1607,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Reset the keys on the underlying array.
*
- * @return static
+ * @return static
*/
public function values()
{
@@ -1533,18 +1620,16 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
* e.g. new Collection([1, 2, 3])->zip([4, 5, 6]);
* => [[1, 4], [2, 5], [3, 6]]
*
- * @param mixed ...$items
- * @return static
+ * @template TZipValue
+ *
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable ...$items
+ * @return static>
*/
public function zip($items)
{
- $arrayableItems = array_map(function ($items) {
- return $this->getArrayableItems($items);
- }, func_get_args());
+ $arrayableItems = array_map(fn ($items) => $this->getArrayableItems($items), func_get_args());
- $params = array_merge([function () {
- return new static(func_get_args());
- }, $this->items], $arrayableItems);
+ $params = array_merge([fn () => new static(func_get_args()), $this->items], $arrayableItems);
return new static(array_map(...$params));
}
@@ -1552,9 +1637,11 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Pad collection to the specified length with a value.
*
+ * @template TPadValue
+ *
* @param int $size
- * @param mixed $value
- * @return static
+ * @param TPadValue $value
+ * @return static
*/
public function pad($size, $value)
{
@@ -1564,10 +1651,9 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get an iterator for the items.
*
- * @return \ArrayIterator
+ * @return \ArrayIterator
*/
- #[\ReturnTypeWillChange]
- public function getIterator()
+ public function getIterator(): Traversable
{
return new ArrayIterator($this->items);
}
@@ -1577,8 +1663,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
*
* @return int
*/
- #[\ReturnTypeWillChange]
- public function count()
+ public function count(): int
{
return count($this->items);
}
@@ -1586,8 +1671,8 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Count the number of items in the collection by a field or using a callback.
*
- * @param callable|string $countBy
- * @return static
+ * @param (callable(TValue, TKey): array-key)|string|null $countBy
+ * @return static
*/
public function countBy($countBy = null)
{
@@ -1597,7 +1682,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Add an item to the collection.
*
- * @param mixed $item
+ * @param TValue $item
* @return $this
*/
public function add($item)
@@ -1610,7 +1695,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get a base Support collection instance from this collection.
*
- * @return \Tightenco\Collect\Support\Collection
+ * @return \QL\Collect\Support\Collection
*/
public function toBase()
{
@@ -1620,11 +1705,10 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Determine if an item exists at an offset.
*
- * @param mixed $key
+ * @param TKey $key
* @return bool
*/
- #[\ReturnTypeWillChange]
- public function offsetExists($key)
+ public function offsetExists($key): bool
{
return isset($this->items[$key]);
}
@@ -1632,11 +1716,10 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Get an item at a given offset.
*
- * @param mixed $key
- * @return mixed
+ * @param TKey $key
+ * @return TValue
*/
- #[\ReturnTypeWillChange]
- public function offsetGet($key)
+ public function offsetGet($key): mixed
{
return $this->items[$key];
}
@@ -1644,12 +1727,11 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Set the item at a given offset.
*
- * @param mixed $key
- * @param mixed $value
+ * @param TKey|null $key
+ * @param TValue $value
* @return void
*/
- #[\ReturnTypeWillChange]
- public function offsetSet($key, $value)
+ public function offsetSet($key, $value): void
{
if (is_null($key)) {
$this->items[] = $value;
@@ -1661,11 +1743,10 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
/**
* Unset the item at a given offset.
*
- * @param mixed $key
+ * @param TKey $key
* @return void
*/
- #[\ReturnTypeWillChange]
- public function offsetUnset($key)
+ public function offsetUnset($key): void
{
unset($this->items[$key]);
}
diff --git a/vendor/tightenco/collect/src/Collect/Support/Enumerable.php b/vendor/jaeger/querylist/src/Collect/Support/Enumerable.php
similarity index 56%
rename from vendor/tightenco/collect/src/Collect/Support/Enumerable.php
rename to vendor/jaeger/querylist/src/Collect/Support/Enumerable.php
index 60af386..942d82e 100644
--- a/vendor/tightenco/collect/src/Collect/Support/Enumerable.php
+++ b/vendor/jaeger/querylist/src/Collect/Support/Enumerable.php
@@ -1,20 +1,32 @@
+ * @extends \IteratorAggregate
+ */
interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable, JsonSerializable
{
/**
* Create a new collection instance if the value isn't one already.
*
- * @param mixed $items
- * @return static
+ * @template TMakeKey of array-key
+ * @template TMakeValue
+ *
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable|null $items
+ * @return static
*/
public static function make($items = []);
@@ -39,16 +51,21 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Wrap the given value in a collection if applicable.
*
- * @param mixed $value
- * @return static
+ * @template TWrapValue
+ *
+ * @param iterable|TWrapValue $value
+ * @return static
*/
public static function wrap($value);
/**
* Get the underlying items from the given collection if applicable.
*
- * @param array|static $value
- * @return array
+ * @template TUnwrapKey of array-key
+ * @template TUnwrapValue
+ *
+ * @param array|static $value
+ * @return array
*/
public static function unwrap($value);
@@ -69,38 +86,38 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Alias for the "avg" method.
*
- * @param callable|string|null $callback
- * @return mixed
+ * @param (callable(TValue): float|int)|string|null $callback
+ * @return float|int|null
*/
public function average($callback = null);
/**
* Get the median of a given key.
*
- * @param string|array|null $key
- * @return mixed
+ * @param string|array|null $key
+ * @return float|int|null
*/
public function median($key = null);
/**
* Get the mode of a given key.
*
- * @param string|array|null $key
- * @return array|null
+ * @param string|array|null $key
+ * @return array|null
*/
public function mode($key = null);
/**
* Collapse the items into a single enumerable.
*
- * @return static
+ * @return static
*/
public function collapse();
/**
* Alias for the "contains" method.
*
- * @param mixed $key
+ * @param (callable(TValue, TKey): bool)|TValue|string $key
* @param mixed $operator
* @param mixed $value
* @return bool
@@ -110,8 +127,8 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Determine if an item exists, using strict comparison.
*
- * @param mixed $key
- * @param mixed $value
+ * @param (callable(TValue): bool)|TValue|array-key $key
+ * @param TValue|null $value
* @return bool
*/
public function containsStrict($key, $value = null);
@@ -119,26 +136,39 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Get the average value of a given key.
*
- * @param callable|string|null $callback
- * @return mixed
+ * @param (callable(TValue): float|int)|string|null $callback
+ * @return float|int|null
*/
public function avg($callback = null);
/**
* Determine if an item exists in the enumerable.
*
- * @param mixed $key
+ * @param (callable(TValue, TKey): bool)|TValue|string $key
* @param mixed $operator
* @param mixed $value
* @return bool
*/
public function contains($key, $operator = null, $value = null);
+ /**
+ * Determine if an item is not contained in the collection.
+ *
+ * @param mixed $key
+ * @param mixed $operator
+ * @param mixed $value
+ * @return bool
+ */
+ public function doesntContain($key, $operator = null, $value = null);
+
/**
* Cross join with the given lists, returning all possible permutations.
*
- * @param mixed ...$lists
- * @return static
+ * @template TCrossJoinKey
+ * @template TCrossJoinValue
+ *
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable ...$lists
+ * @return static>
*/
public function crossJoin(...$lists);
@@ -146,7 +176,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
* Dump the collection and end the script.
*
* @param mixed ...$args
- * @return void
+ * @return never
*/
public function dd(...$args);
@@ -160,7 +190,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Get the items that are not present in the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function diff($items);
@@ -168,8 +198,8 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Get the items that are not present in the given items, using the callback.
*
- * @param mixed $items
- * @param callable $callback
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
+ * @param callable(TValue, TValue): int $callback
* @return static
*/
public function diffUsing($items, callable $callback);
@@ -177,7 +207,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Get the items whose keys and values are not present in the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function diffAssoc($items);
@@ -185,8 +215,8 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Get the items whose keys and values are not present in the given items, using the callback.
*
- * @param mixed $items
- * @param callable $callback
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
+ * @param callable(TKey, TKey): int $callback
* @return static
*/
public function diffAssocUsing($items, callable $callback);
@@ -194,7 +224,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Get the items whose keys are not present in the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function diffKeys($items);
@@ -202,8 +232,8 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Get the items whose keys are not present in the given items, using the callback.
*
- * @param mixed $items
- * @param callable $callback
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
+ * @param callable(TKey, TKey): int $callback
* @return static
*/
public function diffKeysUsing($items, callable $callback);
@@ -211,7 +241,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Retrieve duplicate items.
*
- * @param callable|string|null $callback
+ * @param (callable(TValue): bool)|string|null $callback
* @param bool $strict
* @return static
*/
@@ -220,7 +250,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Retrieve duplicate items using strict comparison.
*
- * @param callable|string|null $callback
+ * @param (callable(TValue): bool)|string|null $callback
* @return static
*/
public function duplicatesStrict($callback = null);
@@ -228,7 +258,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Execute a callback over each item.
*
- * @param callable $callback
+ * @param callable(TValue, TKey): mixed $callback
* @return $this
*/
public function each(callable $callback);
@@ -244,7 +274,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Determine if all items pass the given truth test.
*
- * @param string|callable $key
+ * @param (callable(TValue, TKey): bool)|TValue|string $key
* @param mixed $operator
* @param mixed $value
* @return bool
@@ -254,7 +284,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Get all items except for those with the specified keys.
*
- * @param mixed $keys
+ * @param \QL\Collect\Support\Enumerable|array $keys
* @return static
*/
public function except($keys);
@@ -262,64 +292,76 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Run a filter over each of the items.
*
- * @param callable|null $callback
+ * @param (callable(TValue): bool)|null $callback
* @return static
*/
public function filter(callable $callback = null);
/**
- * Apply the callback if the value is truthy.
+ * Apply the callback if the given "value" is (or resolves to) truthy.
+ *
+ * @template TWhenReturnType as null
*
* @param bool $value
- * @param callable $callback
- * @param callable|null $default
- * @return static|mixed
+ * @param (callable($this): TWhenReturnType)|null $callback
+ * @param (callable($this): TWhenReturnType)|null $default
+ * @return $this|TWhenReturnType
*/
- public function when($value, callable $callback, callable $default = null);
+ public function when($value, callable $callback = null, callable $default = null);
/**
* Apply the callback if the collection is empty.
*
- * @param callable $callback
- * @param callable|null $default
- * @return static|mixed
+ * @template TWhenEmptyReturnType
+ *
+ * @param (callable($this): TWhenEmptyReturnType) $callback
+ * @param (callable($this): TWhenEmptyReturnType)|null $default
+ * @return $this|TWhenEmptyReturnType
*/
public function whenEmpty(callable $callback, callable $default = null);
/**
* Apply the callback if the collection is not empty.
*
- * @param callable $callback
- * @param callable|null $default
- * @return static|mixed
+ * @template TWhenNotEmptyReturnType
+ *
+ * @param callable($this): TWhenNotEmptyReturnType $callback
+ * @param (callable($this): TWhenNotEmptyReturnType)|null $default
+ * @return $this|TWhenNotEmptyReturnType
*/
public function whenNotEmpty(callable $callback, callable $default = null);
/**
- * Apply the callback if the value is falsy.
+ * Apply the callback if the given "value" is (or resolves to) truthy.
+ *
+ * @template TUnlessReturnType
*
* @param bool $value
- * @param callable $callback
- * @param callable|null $default
- * @return static|mixed
+ * @param (callable($this): TUnlessReturnType) $callback
+ * @param (callable($this): TUnlessReturnType)|null $default
+ * @return $this|TUnlessReturnType
*/
public function unless($value, callable $callback, callable $default = null);
/**
* Apply the callback unless the collection is empty.
*
- * @param callable $callback
- * @param callable|null $default
- * @return static|mixed
+ * @template TUnlessEmptyReturnType
+ *
+ * @param callable($this): TUnlessEmptyReturnType $callback
+ * @param (callable($this): TUnlessEmptyReturnType)|null $default
+ * @return $this|TUnlessEmptyReturnType
*/
public function unlessEmpty(callable $callback, callable $default = null);
/**
* Apply the callback unless the collection is not empty.
*
- * @param callable $callback
- * @param callable|null $default
- * @return static|mixed
+ * @template TUnlessNotEmptyReturnType
+ *
+ * @param callable($this): TUnlessNotEmptyReturnType $callback
+ * @param (callable($this): TUnlessNotEmptyReturnType)|null $default
+ * @return $this|TUnlessNotEmptyReturnType
*/
public function unlessNotEmpty(callable $callback, callable $default = null);
@@ -362,7 +404,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
* Filter items by the given key value pair.
*
* @param string $key
- * @param mixed $values
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $values
* @param bool $strict
* @return static
*/
@@ -372,7 +414,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
* Filter items by the given key value pair using strict comparison.
*
* @param string $key
- * @param mixed $values
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $values
* @return static
*/
public function whereInStrict($key, $values);
@@ -381,7 +423,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
* Filter items such that the value of the given key is between the given values.
*
* @param string $key
- * @param array $values
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $values
* @return static
*/
public function whereBetween($key, $values);
@@ -390,7 +432,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
* Filter items such that the value of the given key is not between the given values.
*
* @param string $key
- * @param array $values
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $values
* @return static
*/
public function whereNotBetween($key, $values);
@@ -399,7 +441,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
* Filter items by the given key value pair.
*
* @param string $key
- * @param mixed $values
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $values
* @param bool $strict
* @return static
*/
@@ -409,7 +451,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
* Filter items by the given key value pair using strict comparison.
*
* @param string $key
- * @param mixed $values
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $values
* @return static
*/
public function whereNotInStrict($key, $values);
@@ -417,17 +459,21 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Filter the items, removing any items that don't match the given type(s).
*
- * @param string|string[] $type
- * @return static
+ * @template TWhereInstanceOf
+ *
+ * @param class-string|array> $type
+ * @return static
*/
public function whereInstanceOf($type);
/**
* Get the first item from the enumerable passing the given truth test.
*
- * @param callable|null $callback
- * @param mixed $default
- * @return mixed
+ * @template TFirstDefault
+ *
+ * @param (callable(TValue,TKey): bool)|null $callback
+ * @param TFirstDefault|(\Closure(): TFirstDefault) $default
+ * @return TValue|TFirstDefault
*/
public function first(callable $callback = null, $default = null);
@@ -437,7 +483,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
* @param string $key
* @param mixed $operator
* @param mixed $value
- * @return mixed
+ * @return TValue|null
*/
public function firstWhere($key, $operator = null, $value = null);
@@ -452,44 +498,54 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Flip the values with their keys.
*
- * @return static
+ * @return static
*/
public function flip();
/**
* Get an item from the collection by key.
*
- * @param mixed $key
- * @param mixed $default
- * @return mixed
+ * @template TGetDefault
+ *
+ * @param TKey $key
+ * @param TGetDefault|(\Closure(): TGetDefault) $default
+ * @return TValue|TGetDefault
*/
public function get($key, $default = null);
/**
* Group an associative array by a field or using a callback.
*
- * @param array|callable|string $groupBy
+ * @param (callable(TValue, TKey): array-key)|array|string $groupBy
* @param bool $preserveKeys
- * @return static
+ * @return static>
*/
public function groupBy($groupBy, $preserveKeys = false);
/**
* Key an associative array by a field or using a callback.
*
- * @param callable|string $keyBy
- * @return static
+ * @param (callable(TValue, TKey): array-key)|array|string $keyBy
+ * @return static
*/
public function keyBy($keyBy);
/**
* Determine if an item exists in the collection by key.
*
- * @param mixed $key
+ * @param TKey|array $key
* @return bool
*/
public function has($key);
+ /**
+ * Determine if any of the keys exist in the collection.
+ *
+ * @param mixed $key
+ * @return bool
+ */
+ public function hasAny($key);
+
/**
* Concatenate values of a given key as a string.
*
@@ -502,7 +558,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Intersect the collection with the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function intersect($items);
@@ -510,7 +566,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Intersect the collection with the given items by key.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function intersectByKeys($items);
@@ -529,6 +585,13 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
*/
public function isNotEmpty();
+ /**
+ * Determine if the collection contains a single item.
+ *
+ * @return bool
+ */
+ public function containsOneItem();
+
/**
* Join all items from the collection using a string. The final items can use a separate glue string.
*
@@ -541,24 +604,28 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Get the keys of the collection items.
*
- * @return static
+ * @return static
*/
public function keys();
/**
* Get the last item from the collection.
*
- * @param callable|null $callback
- * @param mixed $default
- * @return mixed
+ * @template TLastDefault
+ *
+ * @param (callable(TValue, TKey): bool)|null $callback
+ * @param TLastDefault|(\Closure(): TLastDefault) $default
+ * @return TValue|TLastDefault
*/
public function last(callable $callback = null, $default = null);
/**
* Run a map over each of the items.
*
- * @param callable $callback
- * @return static
+ * @template TMapValue
+ *
+ * @param callable(TValue, TKey): TMapValue $callback
+ * @return static
*/
public function map(callable $callback);
@@ -575,8 +642,11 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
*
* The callback should return an associative array with a single key/value pair.
*
- * @param callable $callback
- * @return static
+ * @template TMapToDictionaryKey of array-key
+ * @template TMapToDictionaryValue
+ *
+ * @param callable(TValue, TKey): array $callback
+ * @return static>
*/
public function mapToDictionary(callable $callback);
@@ -585,8 +655,11 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
*
* The callback should return an associative array with a single key/value pair.
*
- * @param callable $callback
- * @return static
+ * @template TMapToGroupsKey of array-key
+ * @template TMapToGroupsValue
+ *
+ * @param callable(TValue, TKey): array $callback
+ * @return static>
*/
public function mapToGroups(callable $callback);
@@ -595,31 +668,39 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
*
* The callback should return an associative array with a single key/value pair.
*
- * @param callable $callback
- * @return static
+ * @template TMapWithKeysKey of array-key
+ * @template TMapWithKeysValue
+ *
+ * @param callable(TValue, TKey): array $callback
+ * @return static
*/
public function mapWithKeys(callable $callback);
/**
* Map a collection and flatten the result by a single level.
*
- * @param callable $callback
- * @return static
+ * @template TFlatMapKey of array-key
+ * @template TFlatMapValue
+ *
+ * @param callable(TValue, TKey): (\QL\Collect\Support\Collection|array) $callback
+ * @return static
*/
public function flatMap(callable $callback);
/**
* Map the values into a new class.
*
- * @param string $class
- * @return static
+ * @template TMapIntoValue
+ *
+ * @param class-string $class
+ * @return static
*/
public function mapInto($class);
/**
* Merge the collection with the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function merge($items);
@@ -627,23 +708,27 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Recursively merge the collection with the given items.
*
- * @param mixed $items
- * @return static
+ * @template TMergeRecursiveValue
+ *
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
+ * @return static
*/
public function mergeRecursive($items);
/**
* Create a collection by using this collection for keys and another for its values.
*
- * @param mixed $values
- * @return static
+ * @template TCombineValue
+ *
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $values
+ * @return static
*/
public function combine($values);
/**
* Union the collection with the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function union($items);
@@ -651,7 +736,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Get the min value of a given key.
*
- * @param callable|string|null $callback
+ * @param (callable(TValue):mixed)|string|null $callback
* @return mixed
*/
public function min($callback = null);
@@ -659,7 +744,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Get the max value of a given key.
*
- * @param callable|string|null $callback
+ * @param (callable(TValue):mixed)|string|null $callback
* @return mixed
*/
public function max($callback = null);
@@ -676,7 +761,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Get the items with the specified keys.
*
- * @param mixed $keys
+ * @param \QL\Collect\Support\Enumerable|array|string $keys
* @return static
*/
public function only($keys);
@@ -693,17 +778,17 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Partition the collection into two arrays using the given callback or key.
*
- * @param callable|string $key
+ * @param (callable(TValue, TKey): bool)|TValue|string $key
* @param mixed $operator
* @param mixed $value
- * @return static
+ * @return static, static>
*/
public function partition($key, $operator = null, $value = null);
/**
* Push all of the given items onto the collection.
*
- * @param iterable $source
+ * @param iterable $source
* @return static
*/
public function concat($source);
@@ -712,7 +797,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
* Get one or a specified number of items randomly from the collection.
*
* @param int|null $number
- * @return static|mixed
+ * @return static|TValue
*
* @throws \InvalidArgumentException
*/
@@ -721,16 +806,30 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Reduce the collection to a single value.
*
- * @param callable $callback
- * @param mixed $initial
- * @return mixed
+ * @template TReduceInitial
+ * @template TReduceReturnType
+ *
+ * @param callable(TReduceInitial|TReduceReturnType, TValue, TKey): TReduceReturnType $callback
+ * @param TReduceInitial $initial
+ * @return TReduceReturnType
*/
public function reduce(callable $callback, $initial = null);
+ /**
+ * Reduce the collection to multiple aggregate values.
+ *
+ * @param callable $callback
+ * @param mixed ...$initial
+ * @return array
+ *
+ * @throws \UnexpectedValueException
+ */
+ public function reduceSpread(callable $callback, ...$initial);
+
/**
* Replace the collection items with the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function replace($items);
@@ -738,7 +837,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Recursively replace the collection items with the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function replaceRecursive($items);
@@ -753,9 +852,9 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Search the collection for a given value and return the corresponding key if successful.
*
- * @param mixed $value
+ * @param TValue|callable(TValue,TKey): bool $value
* @param bool $strict
- * @return mixed
+ * @return TKey|bool
*/
public function search($value, $strict = false);
@@ -767,6 +866,15 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
*/
public function shuffle($seed = null);
+ /**
+ * Create chunks representing a "sliding window" view of the items in the collection.
+ *
+ * @param int $size
+ * @param int $step
+ * @return static
+ */
+ public function sliding($size = 2, $step = 1);
+
/**
* Skip the first {$count} items.
*
@@ -778,7 +886,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Skip items in the collection until the given condition is met.
*
- * @param mixed $value
+ * @param TValue|callable(TValue,TKey): bool $value
* @return static
*/
public function skipUntil($value);
@@ -786,7 +894,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Skip items in the collection while the given condition is met.
*
- * @param mixed $value
+ * @param TValue|callable(TValue,TKey): bool $value
* @return static
*/
public function skipWhile($value);
@@ -804,30 +912,63 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
* Split a collection into a certain number of groups.
*
* @param int $numberOfGroups
- * @return static
+ * @return static
*/
public function split($numberOfGroups);
+ /**
+ * Get the first item in the collection, but only if exactly one item exists. Otherwise, throw an exception.
+ *
+ * @param (callable(TValue, TKey): bool)|string $key
+ * @param mixed $operator
+ * @param mixed $value
+ * @return TValue
+ *
+ * @throws \QL\Collect\Support\ItemNotFoundException
+ * @throws \QL\Collect\Support\MultipleItemsFoundException
+ */
+ public function sole($key = null, $operator = null, $value = null);
+
+ /**
+ * Get the first item in the collection but throw an exception if no matching items exist.
+ *
+ * @param (callable(TValue, TKey): bool)|string $key
+ * @param mixed $operator
+ * @param mixed $value
+ * @return TValue
+ *
+ * @throws \QL\Collect\Support\ItemNotFoundException
+ */
+ public function firstOrFail($key = null, $operator = null, $value = null);
+
/**
* Chunk the collection into chunks of the given size.
*
* @param int $size
- * @return static
+ * @return static
*/
public function chunk($size);
/**
* Chunk the collection into chunks with a callback.
*
- * @param callable $callback
- * @return static
+ * @param callable(TValue, TKey, static): bool $callback
+ * @return static>
*/
public function chunkWhile(callable $callback);
+ /**
+ * Split a collection into a certain number of groups, and fill the first groups completely.
+ *
+ * @param int $numberOfGroups
+ * @return static
+ */
+ public function splitIn($numberOfGroups);
+
/**
* Sort through each item with a callback.
*
- * @param callable|null|int $callback
+ * @param (callable(TValue, TValue): int)|null|int $callback
* @return static
*/
public function sort($callback = null);
@@ -843,7 +984,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Sort the collection using the given callback.
*
- * @param callable|string $callback
+ * @param array|(callable(TValue, TKey): mixed)|string $callback
* @param int $options
* @param bool $descending
* @return static
@@ -853,7 +994,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Sort the collection in descending order using the given callback.
*
- * @param callable|string $callback
+ * @param array|(callable(TValue, TKey): mixed)|string $callback
* @param int $options
* @return static
*/
@@ -876,10 +1017,18 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
*/
public function sortKeysDesc($options = SORT_REGULAR);
+ /**
+ * Sort the collection keys using a callback.
+ *
+ * @param callable(TKey, TKey): int $callback
+ * @return static
+ */
+ public function sortKeysUsing(callable $callback);
+
/**
* Get the sum of the given values.
*
- * @param callable|string|null $callback
+ * @param (callable(TValue): mixed)|string|null $callback
* @return mixed
*/
public function sum($callback = null);
@@ -895,7 +1044,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Take items in the collection until the given condition is met.
*
- * @param mixed $value
+ * @param TValue|callable(TValue,TKey): bool $value
* @return static
*/
public function takeUntil($value);
@@ -903,7 +1052,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Take items in the collection while the given condition is met.
*
- * @param mixed $value
+ * @param TValue|callable(TValue,TKey): bool $value
* @return static
*/
public function takeWhile($value);
@@ -911,7 +1060,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Pass the collection to the given callback and then return it.
*
- * @param callable $callback
+ * @param callable(TValue): mixed $callback
* @return $this
*/
public function tap(callable $callback);
@@ -919,32 +1068,57 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Pass the enumerable to the given callback and return the result.
*
- * @param callable $callback
- * @return mixed
+ * @template TPipeReturnType
+ *
+ * @param callable($this): TPipeReturnType $callback
+ * @return TPipeReturnType
*/
public function pipe(callable $callback);
+ /**
+ * Pass the collection into a new class.
+ *
+ * @param class-string $class
+ * @return mixed
+ */
+ public function pipeInto($class);
+
+ /**
+ * Pass the collection through a series of callable pipes and return the result.
+ *
+ * @param array $pipes
+ * @return mixed
+ */
+ public function pipeThrough($pipes);
+
/**
* Get the values of a given key.
*
- * @param string|array $value
+ * @param string|array $value
* @param string|null $key
- * @return static
+ * @return static
*/
public function pluck($value, $key = null);
/**
* Create a collection of all elements that do not pass a given truth test.
*
- * @param callable|mixed $callback
+ * @param (callable(TValue, TKey): bool)|bool|TValue $callback
* @return static
*/
public function reject($callback = true);
+ /**
+ * Convert a flatten "dot" notation array into an expanded array.
+ *
+ * @return static
+ */
+ public function undot();
+
/**
* Return only unique items from the collection array.
*
- * @param string|callable|null $key
+ * @param (callable(TValue, TKey): mixed)|string|null $key
* @param bool $strict
* @return static
*/
@@ -953,7 +1127,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Return only unique items from the collection array using strict comparison.
*
- * @param string|callable|null $key
+ * @param (callable(TValue, TKey): mixed)|string|null $key
* @return static
*/
public function uniqueStrict($key = null);
@@ -961,26 +1135,42 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
/**
* Reset the keys on the underlying array.
*
- * @return static
+ * @return static
*/
public function values();
/**
* Pad collection to the specified length with a value.
*
+ * @template TPadValue
+ *
* @param int $size
- * @param mixed $value
- * @return static
+ * @param TPadValue $value
+ * @return static
*/
public function pad($size, $value);
/**
- * Count the number of items in the collection using a given truth test.
+ * Get the values iterator.
*
- * @param callable|null $callback
- * @return static
+ * @return \Traversable
*/
- public function countBy($callback = null);
+ public function getIterator(): Traversable;
+
+ /**
+ * Count the number of items in the collection.
+ *
+ * @return int
+ */
+ public function count(): int;
+
+ /**
+ * Count the number of items in the collection by a field or using a callback.
+ *
+ * @param (callable(TValue, TKey): array-key)|string|null $countBy
+ * @return static
+ */
+ public function countBy($countBy = null);
/**
* Zip the collection together with one or more arrays.
@@ -988,18 +1178,50 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
* e.g. new Collection([1, 2, 3])->zip([4, 5, 6]);
* => [[1, 4], [2, 5], [3, 6]]
*
- * @param mixed ...$items
- * @return static
+ * @template TZipValue
+ *
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable ...$items
+ * @return static>
*/
public function zip($items);
/**
* Collect the values into a collection.
*
- * @return \Tightenco\Collect\Support\Collection
+ * @return \QL\Collect\Support\Collection
*/
public function collect();
+ /**
+ * Get the collection of items as a plain array.
+ *
+ * @return array
+ */
+ public function toArray();
+
+ /**
+ * Convert the object into something JSON serializable.
+ *
+ * @return mixed
+ */
+ public function jsonSerialize(): mixed;
+
+ /**
+ * Get the collection of items as JSON.
+ *
+ * @param int $options
+ * @return string
+ */
+ public function toJson($options = 0);
+
+ /**
+ * Get a CachingIterator instance.
+ *
+ * @param int $flags
+ * @return \CachingIterator
+ */
+ public function getCachingIterator($flags = CachingIterator::CALL_TOSTRING);
+
/**
* Convert the collection to its string representation.
*
@@ -1007,6 +1229,14 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
*/
public function __toString();
+ /**
+ * Indicate that the model's string representation should be escaped when __toString is invoked.
+ *
+ * @param bool $escape
+ * @return $this
+ */
+ public function escapeWhenCastingToString($escape = true);
+
/**
* Add a method to the list of proxied methods.
*
diff --git a/vendor/tightenco/collect/src/Collect/Support/HigherOrderCollectionProxy.php b/vendor/jaeger/querylist/src/Collect/Support/HigherOrderCollectionProxy.php
similarity index 86%
rename from vendor/tightenco/collect/src/Collect/Support/HigherOrderCollectionProxy.php
rename to vendor/jaeger/querylist/src/Collect/Support/HigherOrderCollectionProxy.php
index 01ac43f..c18f44f 100644
--- a/vendor/tightenco/collect/src/Collect/Support/HigherOrderCollectionProxy.php
+++ b/vendor/jaeger/querylist/src/Collect/Support/HigherOrderCollectionProxy.php
@@ -1,16 +1,16 @@
+ */
class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
{
+ /**
+ * @use \QL\Collect\Support\Traits\EnumeratesValues
+ */
use EnumeratesValues, Macroable;
/**
* The source from which to generate items.
*
- * @var callable|static
+ * @var (Closure(): \Generator)|static|array
*/
public $source;
/**
* Create a new lazy collection instance.
*
- * @param mixed $source
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable|(Closure(): \Generator)|self|array|null $source
* @return void
*/
public function __construct($source = null)
@@ -34,17 +46,35 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
$this->source = $source;
} elseif (is_null($source)) {
$this->source = static::empty();
+ } elseif ($source instanceof Generator) {
+ throw new InvalidArgumentException(
+ 'Generators should not be passed directly to LazyCollection. Instead, pass a generator function.'
+ );
} else {
$this->source = $this->getArrayableItems($source);
}
}
+ /**
+ * Create a new collection instance if the value isn't one already.
+ *
+ * @template TMakeKey of array-key
+ * @template TMakeValue
+ *
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable|(Closure(): \Generator)|self|array|null $items
+ * @return static
+ */
+ public static function make($items = [])
+ {
+ return new static($items);
+ }
+
/**
* Create a collection with the given range.
*
* @param int $from
* @param int $to
- * @return static
+ * @return static
*/
public static function range($from, $to)
{
@@ -64,7 +94,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Get all items in the enumerable.
*
- * @return array
+ * @return array
*/
public function all()
{
@@ -126,8 +156,8 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Get the average value of a given key.
*
- * @param callable|string|null $callback
- * @return mixed
+ * @param (callable(TValue): float|int)|string|null $callback
+ * @return float|int|null
*/
public function avg($callback = null)
{
@@ -137,8 +167,8 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Get the median of a given key.
*
- * @param string|array|null $key
- * @return mixed
+ * @param string|array|null $key
+ * @return float|int|null
*/
public function median($key = null)
{
@@ -148,8 +178,8 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Get the mode of a given key.
*
- * @param string|array|null $key
- * @return array|null
+ * @param string|array|null $key
+ * @return array|null
*/
public function mode($key = null)
{
@@ -159,7 +189,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Collapse the collection of items into a single array.
*
- * @return static
+ * @return static
*/
public function collapse()
{
@@ -177,7 +207,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Determine if an item exists in the enumerable.
*
- * @param mixed $key
+ * @param (callable(TValue, TKey): bool)|TValue|string $key
* @param mixed $operator
* @param mixed $value
* @return bool
@@ -187,6 +217,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
if (func_num_args() === 1 && $this->useAsCallable($key)) {
$placeholder = new stdClass;
+ /** @var callable $key */
return $this->first($key, $placeholder) !== $placeholder;
}
@@ -205,6 +236,32 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
return $this->contains($this->operatorForWhere(...func_get_args()));
}
+ /**
+ * Determine if an item exists, using strict comparison.
+ *
+ * @param (callable(TValue): bool)|TValue|array-key $key
+ * @param TValue|null $value
+ * @return bool
+ */
+ public function containsStrict($key, $value = null)
+ {
+ if (func_num_args() === 2) {
+ return $this->contains(fn ($item) => data_get($item, $key) === $value);
+ }
+
+ if ($this->useAsCallable($key)) {
+ return ! is_null($this->first($key));
+ }
+
+ foreach ($this as $item) {
+ if ($item === $key) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
/**
* Determine if an item is not contained in the enumerable.
*
@@ -221,8 +278,11 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Cross join the given iterables, returning all possible permutations.
*
- * @param array ...$arrays
- * @return static
+ * @template TCrossJoinKey
+ * @template TCrossJoinValue
+ *
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable ...$arrays
+ * @return static>
*/
public function crossJoin(...$arrays)
{
@@ -232,8 +292,8 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Count the number of items in the collection by a field or using a callback.
*
- * @param callable|string $countBy
- * @return static
+ * @param (callable(TValue, TKey): array-key)|string|null $countBy
+ * @return static
*/
public function countBy($countBy = null)
{
@@ -261,7 +321,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Get the items that are not present in the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function diff($items)
@@ -272,8 +332,8 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Get the items that are not present in the given items, using the callback.
*
- * @param mixed $items
- * @param callable $callback
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
+ * @param callable(TValue, TValue): int $callback
* @return static
*/
public function diffUsing($items, callable $callback)
@@ -284,7 +344,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Get the items whose keys and values are not present in the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function diffAssoc($items)
@@ -295,8 +355,8 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Get the items whose keys and values are not present in the given items, using the callback.
*
- * @param mixed $items
- * @param callable $callback
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
+ * @param callable(TKey, TKey): int $callback
* @return static
*/
public function diffAssocUsing($items, callable $callback)
@@ -307,7 +367,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Get the items whose keys are not present in the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function diffKeys($items)
@@ -318,8 +378,8 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Get the items whose keys are not present in the given items, using the callback.
*
- * @param mixed $items
- * @param callable $callback
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
+ * @param callable(TKey, TKey): int $callback
* @return static
*/
public function diffKeysUsing($items, callable $callback)
@@ -330,7 +390,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Retrieve duplicate items.
*
- * @param callable|string|null $callback
+ * @param (callable(TValue): bool)|string|null $callback
* @param bool $strict
* @return static
*/
@@ -342,7 +402,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Retrieve duplicate items using strict comparison.
*
- * @param callable|string|null $callback
+ * @param (callable(TValue): bool)|string|null $callback
* @return static
*/
public function duplicatesStrict($callback = null)
@@ -353,7 +413,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Get all items except for those with the specified keys.
*
- * @param mixed $keys
+ * @param \QL\Collect\Support\Enumerable|array $keys
* @return static
*/
public function except($keys)
@@ -364,15 +424,13 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Run a filter over each of the items.
*
- * @param callable|null $callback
+ * @param (callable(TValue, TKey): bool)|null $callback
* @return static
*/
public function filter(callable $callback = null)
{
if (is_null($callback)) {
- $callback = function ($value) {
- return (bool) $value;
- };
+ $callback = fn ($value) => (bool) $value;
}
return new static(function () use ($callback) {
@@ -387,9 +445,11 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Get the first item from the enumerable passing the given truth test.
*
- * @param callable|null $callback
- * @param mixed $default
- * @return mixed
+ * @template TFirstDefault
+ *
+ * @param (callable(TValue): bool)|null $callback
+ * @param TFirstDefault|(\Closure(): TFirstDefault) $default
+ * @return TValue|TFirstDefault
*/
public function first(callable $callback = null, $default = null)
{
@@ -416,7 +476,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
* Get a flattened list of the items in the collection.
*
* @param int $depth
- * @return static
+ * @return static
*/
public function flatten($depth = INF)
{
@@ -438,7 +498,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Flip the items in the collection.
*
- * @return static
+ * @return static
*/
public function flip()
{
@@ -452,9 +512,11 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Get an item by key.
*
- * @param mixed $key
- * @param mixed $default
- * @return mixed
+ * @template TGetDefault
+ *
+ * @param TKey|null $key
+ * @param TGetDefault|(\Closure(): TGetDefault) $default
+ * @return TValue|TGetDefault
*/
public function get($key, $default = null)
{
@@ -474,9 +536,9 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Group an associative array by a field or using a callback.
*
- * @param array|callable|string $groupBy
+ * @param (callable(TValue, TKey): array-key)|array|string $groupBy
* @param bool $preserveKeys
- * @return static
+ * @return static>
*/
public function groupBy($groupBy, $preserveKeys = false)
{
@@ -486,8 +548,8 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Key an associative array by a field or using a callback.
*
- * @param callable|string $keyBy
- * @return static
+ * @param (callable(TValue, TKey): array-key)|array|string $keyBy
+ * @return static
*/
public function keyBy($keyBy)
{
@@ -548,7 +610,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Concatenate values of a given key as a string.
*
- * @param string $value
+ * @param callable|string $value
* @param string|null $glue
* @return string
*/
@@ -560,7 +622,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Intersect the collection with the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function intersect($items)
@@ -568,10 +630,45 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
return $this->passthru('intersect', func_get_args());
}
+ /**
+ * Intersect the collection with the given items, using the callback.
+ *
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
+ * @param callable(TValue, TValue): int $callback
+ * @return static
+ */
+ public function intersectUsing()
+ {
+ return $this->passthru('intersectUsing', func_get_args());
+ }
+
+ /**
+ * Intersect the collection with the given items with additional index check.
+ *
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
+ * @return static
+ */
+ public function intersectAssoc($items)
+ {
+ return $this->passthru('intersectAssoc', func_get_args());
+ }
+
+ /**
+ * Intersect the collection with the given items with additional index check, using the callback.
+ *
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
+ * @param callable(TValue, TValue): int $callback
+ * @return static
+ */
+ public function intersectAssocUsing($items, callable $callback)
+ {
+ return $this->passthru('intersectAssocUsing', func_get_args());
+ }
+
/**
* Intersect the collection with the given items by key.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function intersectByKeys($items)
@@ -614,7 +711,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Get the keys of the collection items.
*
- * @return static
+ * @return static
*/
public function keys()
{
@@ -628,9 +725,11 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Get the last item from the collection.
*
- * @param callable|null $callback
- * @param mixed $default
- * @return mixed
+ * @template TLastDefault
+ *
+ * @param (callable(TValue, TKey): bool)|null $callback
+ * @param TLastDefault|(\Closure(): TLastDefault) $default
+ * @return TValue|TLastDefault
*/
public function last(callable $callback = null, $default = null)
{
@@ -648,9 +747,9 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Get the values of a given key.
*
- * @param string|array $value
+ * @param string|array $value
* @param string|null $key
- * @return static
+ * @return static
*/
public function pluck($value, $key = null)
{
@@ -678,8 +777,10 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Run a map over each of the items.
*
- * @param callable $callback
- * @return static
+ * @template TMapValue
+ *
+ * @param callable(TValue, TKey): TMapValue $callback
+ * @return static
*/
public function map(callable $callback)
{
@@ -695,8 +796,11 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
*
* The callback should return an associative array with a single key/value pair.
*
- * @param callable $callback
- * @return static
+ * @template TMapToDictionaryKey of array-key
+ * @template TMapToDictionaryValue
+ *
+ * @param callable(TValue, TKey): array $callback
+ * @return static>
*/
public function mapToDictionary(callable $callback)
{
@@ -708,8 +812,11 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
*
* The callback should return an associative array with a single key/value pair.
*
- * @param callable $callback
- * @return static
+ * @template TMapWithKeysKey of array-key
+ * @template TMapWithKeysValue
+ *
+ * @param callable(TValue, TKey): array $callback
+ * @return static
*/
public function mapWithKeys(callable $callback)
{
@@ -723,7 +830,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Merge the collection with the given items.
*
- * @param mixed $items
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
* @return static
*/
public function merge($items)
@@ -734,8 +841,10 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Recursively merge the collection with the given items.
*
- * @param mixed $items
- * @return static
+ * @template TMergeRecursiveValue
+ *
+ * @param \QL\Collect\Contracts\Support\Arrayable|iterable $items
+ * @return static
*/
public function mergeRecursive($items)
{
@@ -745,8 +854,10 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
/**
* Create a collection by using this collection for keys and another for its values.
*
- * @param mixed $values
- * @return static
+ * @template TCombineValue
+ *
+ * @param \IteratorAggregate|array|(callable(): \Generator