Merge pull request #110 from jae-jae/develop

replace collect()
This commit is contained in:
Jaeger(黄杰) 2020-04-03 04:55:27 -05:00 committed by GitHub
commit e527c637c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 6 deletions

View File

@ -7,6 +7,7 @@
namespace QL;
use Closure;
use Tightenco\Collect\Support\Collection;
class Config
{
@ -20,8 +21,8 @@ class Config
*/
public function __construct()
{
$this->plugins = collect();
$this->binds = collect();
$this->plugins = new Collection();
$this->binds = new Collection();
}

View File

@ -9,6 +9,7 @@ namespace QL\Dom;
use phpDocumentor\Reflection\Types\Null_;
use phpQueryObject;
use Tightenco\Collect\Support\Collection;
/**
* Class Elements
@ -191,7 +192,7 @@ class Elements
*/
public function map($callback)
{
$collection = collect();
$collection = new Collection();
$this->elements->each(function ($dom) use (& $collection, $callback) {
$collection->push($callback(new self(pq($dom))));
});

View File

@ -147,7 +147,7 @@ class Query
{
if (is_callable($callback)) {
if (empty($this->range)) {
$data = collect($callback($data->all(), null));
$data = new Collection($callback($data->all(), null));
} else {
$data = $data->map($callback);
}
@ -178,7 +178,7 @@ class Query
}
}
return collect($data);
return new Collection($data);
}
protected function extractContent(phpQueryObject $pqObj, $ruleName, $rule)

View File

@ -14,6 +14,7 @@ use Closure;
use QL\Providers\HttpServiceProvider;
use QL\Providers\PluginServiceProvider;
use QL\Providers\SystemServiceProvider;
use Tightenco\Collect\Support\Collection;
class Kernel
{
@ -34,7 +35,7 @@ class Kernel
public function __construct(QueryList $ql)
{
$this->ql = $ql;
$this->binds = collect();
$this->binds = new Collection();
}
public function bootstrap()