Array map

@param  Closure $closure
@return $this
346538
public function map(Closure $closure): Collection
    {
        $this->items = array_map($closure, $this->items);
        return $this;
    }
744976
public function map(\Closure $callback) : Collection
    {
        $keys = array_keys($this->data);
        $values = array_map($callback, $this->data, $keys);

        return static::create(array_combine($keys, $values));
    }
958051
public function aggregate(\Closure $closure)
    {
        $builder = new AggregationBuilder($this->query);

        $closure($builder);

        return $this;
    }
1279441
public function handle(Closure $closure)
    {
        $result = \call_user_func($closure, $this->getMessage(), [$this, 'fail'], [$this, 'alert']);

        $attributes = [
            'result_code' => is_null($this->alert) && is_null($this->fail) ? static::SUCCESS : static::FAIL,
            'err_code_des' => $this->alert,
        ];

        if (is_null($this->alert) && is_string($result)) {
            $attributes += [
                'appid' => $this->app['config']->app_id,
                'mch_id' => $this->app['config']->mch_id,
                'nonce_str' => uniqid(),
                'prepay_id' => $result,
            ];
        }

        return $this->respondWith($attributes, true)->toResponse();
    }
115063
public function map(Closure $func)
    {
        $clone = clone $this;

        $clone->data = array_map($func, $this->data);
        $clone->updateBody();

        return $clone;
    }
1239031
function sortCustomKey(callable $closure) {
        $args = $this->baseStorageArgs;
        $args[] = parent::sortCustomKey($closure)->all();
        
        return (new static(...$args));
    }
1094266
public function map(\Closure $callback)
    {

        $this->_items = array_map($callback, $this->_items);

        return $this;
    }
1084637
public function each(\Closure $closure): self
    {
        // init
        $array = [];

        foreach ($this->getGenerator() as $key => $value) {
            $array[$key] = $closure($value, $key);
        }

        return static::create(
            $array,
            $this->iteratorClass,
            false
        );
    }
93230
public static function from(Closure $closure)
    {
        if (static::$context === null) {
            $instance = new static($closure);
        } elseif (isset(static::$context->scope[$closure])) {
            $instance = static::$context->scope[$closure];
        } else {
            $instance = new static($closure);
            static::$context->scope[$closure] = $instance;
        }

        return $instance;
    }
1080900
public function filter($closure)
    {
        $data = [];
        foreach ($this as $val) {
            if ($closure($val)) {
                $data[] = $val;
            }
        }
        return new Collection(compact('data'));
    }
850921
function each(callable $closure) {
        foreach($this->data as $key => $val) {
            $feed = $closure($val, $key);
            if($feed === false) {
                break;
            }
        }
        
        return $this;
    }
948051
public static function group(array $attributes, Closure $closure)
    {
        $hash = uniqid('prop_');
        //Add options
        if (isset($attributes['prefix'])) {
            static::$groupsProps['prefix'][$hash] = $attributes['prefix'];
        }
        if (isset($attributes['namespace'])) {
            static::$groupsProps['namespace'][$hash] = $attributes['namespace'];
        }
        if (isset($attributes['name'])) {
            static::$groupsProps['name'][$hash] = $attributes['name'];
        }
        if (isset($attributes['middlewares']) || isset($attributes['middleware'])) {
            static::$groupsProps['middleware'][$hash] = isset($attributes['middleware']) ?
                (array)$attributes['middleware'] :
                (array)$attributes['middlewares'];
        }
        //Run closure
        $closure();
        //Remove options
        unset(static::$groupsProps['prefix'][$hash]);
        unset(static::$groupsProps['namespace'][$hash]);
        unset(static::$groupsProps['name'][$hash]);
        unset(static::$groupsProps['middleware'][$hash]);
    }
614060
public function share(Closure $closure)
		{
			return function($Eventable) use ($closure) {
				// We'll simply declare a static variable within the Closures and if it has
				// not been set we will execute the given Closures to resolve this value
				// and return it back to these consumers of the method as an instance.
				static $object;
				if (is_null($object)) {
					$object = $closure($Eventable);
				}
				return $object;
			};
		}
1202708
private function withPrimaryReadPreference(\Closure $closure)
    {
        $prevReadPref = $this->mongoCollection->getReadPreference();
        $this->mongoCollection->setReadPreference(\MongoClient::RP_PRIMARY);

        try {
            return $closure();
        } finally {
            $prevTags = ! empty($prevReadPref['tagsets']) ? $prevReadPref['tagsets'] : [];
            $this->mongoCollection->setReadPreference($prevReadPref['type'], $prevTags);
        }
    }
647163
public function getFilterCallback(Closure $closure)
  {
    $filter = function(&$item) use ($closure){
      $closure($item);
      return true;
    };
    return $filter;
  }
818102
public function filter(\Closure $callback)
    {
        $results = array_filter($this->all(), $callback, ARRAY_FILTER_USE_BOTH);

        return new static($results);
    }
852403
public function orWhere(\Closure $closure = null) {
        $this->query->push(['OR']);
        if($closure !== null) $closure($this);

        return $this;
    }