Remove empty values from collection

@param $collection
507631
protected function removeEmpty($collection) {
        foreach ($collection as $key => $value) {
            if (empty($value)) {
                unset($collection[$key]);
            }
        }

        return $collection;
    }
923253
public function deleteFileUploadFolders(array $collection) {
		$timeStamp = microtime(true);
		$countDeleted = 0;
		foreach($collection as $entry){
			if($entry instanceof BundleEntity\FileUploadFolder){
				$this->em->remove($entry);
				$countDeleted++;
			}
			else{
				$response = $this->getFileUploadFolder($entry);
				if(!$response->error->exist){
					$entry = $response->result->set;
					$this->em->remove($entry);
					$countDeleted++;
				}
			}
		}
		if($countDeleted < 0){
			return new ModelResponse(null, 0, 0, null, true, 'E:E:001', 'Unable to delete all or some of the selected entries.', $timeStamp, microtime(true));
		}
		$this->em->flush();

		return new ModelResponse(null, 0, 0, null, false, 'S:D:001', 'Selected entries have been successfully removed from database.', $timeStamp, microtime(true));
	}
264873
public function shuffle($collection=null) {
    list($collection) = self::_wrapArgs(func_get_args(), 1);
    
    $collection = (array) self::_collection($collection);
    shuffle($collection);
     
    return self::_wrap($collection);
  }
224449
protected function postCollectionModifiers(Collection $collection)
    {
        if ($this->getOrderByField() && $this->getOrderByDirection()) {
            $field = $this->getOrderByField();
            $desc  = false;

            if ($this->getOrderByDirection() === 'desc') {
                $desc = true;
            }

            $sorted = $collection->sortBy(function ($entry) use ($field) {
                if (property_exists($entry, $field)) {
                    return $entry->{$field};
                }
            }, SORT_NATURAL, $desc);

            return $sorted;
        }

        return $collection;
    }
545777
public function removeUsers(ArrayCollection $users)
    {
        foreach ($users as $user) {
            $user->removeTeam($this);
            $this->users->removeElement($user);
        }
    }
111588
public function remove($indexValue)
    {
        if (\is_object($indexValue)) {
            foreach ($this->arrCollection as $collectionIndex => $model) {
                if ($indexValue === $model) {
                    unset($this->arrCollection[$collectionIndex]);
                }
            }
        } else {
            unset($this->arrCollection[$indexValue]);
        }

        $this->arrCollection = \array_values($this->arrCollection);
    }
1334884
public function deleteProductCategories($collection)
	{
		$timeStamp = time();
		if (!is_array($collection)) {
			return $this->createException('InvalidParameterValueException', 'Invalid parameter value. Parameter must be an array collection', 'E:S:001');
		}
		$countDeleted = 0;
		foreach ($collection as $entry) {
			if ($entry instanceof BundleEntity\ProductCategory) {
				$this->em->remove($entry);
				$countDeleted++;
			} else {
				$response = $this->getProductCategory($entry);
				if (!$response->error->exist) {
					$this->em->remove($response->result->set);
					$countDeleted++;
				}
			}
		}
		if ($countDeleted < 0) {
			return new ModelResponse(null, 0, 0, null, true, 'E:E:001', 'Unable to delete all or some of the selected entries.', $timeStamp, time());
		}
		$this->em->flush();
		return new ModelResponse(null, 0, 0, null, false, 'S:D:001', 'Selected entries have been successfully removed from database.', $timeStamp, time());
	}
988766
public static <T> Collection<T> removeNull(Collection<T> collection) {
		return filter(collection, new Editor<T>() {
			@Override
			public T edit(T t) {
				// 返回null便不加入集合
				return t;
			}
		});
	}
889162
public function hasCollection($collection)
    {
        if (empty($this->queriesResultCache[ 'collectionNames' ])) {
            $this->getCollections();
        }

        return (bool)in_array($collection, $this->queriesResultCache[ 'collectionNames' ]);
    }
1282198
public function delete(object $parent, array $collections, array $options) : void
    {
        $unsetPathsMap = [];

        foreach ($collections as $collection) {
            $mapping = $collection->getMapping();
            if ($mapping['isInverseSide']) {
                continue; // ignore inverse side
            }
            if (CollectionHelper::isAtomic($mapping['strategy'])) {
                throw new UnexpectedValueException($mapping['strategy'] . ' delete collection strategy should have been handled by DocumentPersister. Please report a bug in issue tracker');
            }
            [$propertyPath]               = $this->getPathAndParent($collection);
            $unsetPathsMap[$propertyPath] = true;
        }

        if (empty($unsetPathsMap)) {
            return;
        }

        /** @var string[] $unsetPaths */
        $unsetPaths = array_keys($unsetPathsMap);

        $unsetPaths = array_fill_keys($this->excludeSubPaths($unsetPaths), true);
        $query      = ['$unset' => $unsetPaths];
        $this->executeQuery($parent, $query, $options);
    }
825791
public function deleteVolumePricings($collection)
	{
		$timeStamp = time();
		if (!is_array($collection)) {
			return $this->createException('InvalidParameterValueException', 'Invalid parameter value. Parameter must be an array collection', 'E:S:001');
		}
		$countDeleted = 0;
		foreach ($collection as $entry) {
			if ($entry instanceof BundleEntity\VolumePricing) {
				$this->em->remove($entry);
				$countDeleted++;
			} else {
				$response = $this->getVolumePricing($entry);
				if (!$response->error->exist) {
					$this->em->remove($response->result->set);
					$countDeleted++;
				}
			}
		}
		if ($countDeleted < 0) {
			return new ModelResponse(null, 0, 0, null, true, 'E:E:001', 'Unable to delete all or some of the selected entries.', $timeStamp, time());
		}
		$this->em->flush();
		return new ModelResponse(null, 0, 0, null, false, 'S:D:001', 'Selected entries have been successfully removed from database.', $timeStamp, time());
	}
266084
public static function clearNullValues(&$array)
    {
        foreach ($array as $key => &$value) {
            if (null === $value) {
                unset($array[$key]);
            } else if (is_array($value)) {
                self::clearNullValues($value);
                if (empty($value)) {
                    unset($array[$key]);
                }
            }
        }

        return $array;
    }
30645
public function clean($collection)
    {
        $entry = $this->manifest->get($collection);

        // If the collection exists on the environment then we'll proceed with cleaning the filesystem
        // This removes any double-up production and development builds.
        if (isset($this->environment[$collection]))
        {
            $this->cleanFilesystem($this->environment[$collection], $entry);
        }

        // If the collection does not exist on the environment then we'll instrcut the manifest to
        // forget this collection.
        else
        {
            $this->manifest->forget($collection);
        }

        // Cleaning the manifest is important as it will also remove unnecessary files from the
        // filesystem if a collection has been removed.
        $this->cleanManifestFiles($collection, $entry);

        $this->manifest->save();
    }
1062600
public function delete($value)
    {
        foreach (array_keys($this->collection, $value, true) as $key) {
            unset($this->collection[$key]);
        }

        return $this;
    }
1164063
@Override
	public boolean removeAll(Collection<?> collection) {
		if (booleanTerms == null) {
			return false;
		}
		return booleanTerms.removeAll(collection);
	}
36488
protected function filterEmpty()
    {
        $vars = $this->toArray();
        foreach ($vars as $name => $value) {
            if (!strlen($value)) {
                unset($this->{$name});
            }
        }
    }
1121454
public function minify($collection) {
		// check final path
		$public_path = $this->f3->get('ASSETS.minify.public_path');
		if (!is_dir($public_path))
			mkdir($public_path,0777,true);
		$type = false;
		$inline_stack = array();
		foreach($collection as $i=>&$asset) {
			$type = $asset['type'];
			if ($asset['origin']=='inline') {
				$slot = $asset['slot'] ?: 'default';
				$inline_stack[$slot][] = $asset['data'];
				unset($collection[$i]);
				unset($asset);
				continue;
			}
			$path = $asset['path'];
			$exclude = $this->f3->get('ASSETS.minify.exclude');
			// skip external files
			if ($asset['origin'] == 'external')
				continue;
			elseif (is_file($path) && (
				(!isset($asset['exclude']) ||
					!in_array('minify',$this->f3->split($asset['exclude']))) &&
				(empty($exclude) || !preg_match('/'.$exclude.'/i',$path)))) {
				// proceed
				$path_parts = pathinfo($path);
				$filename = $path_parts['filename'].'.'
					.substr($this->f3->hash($path),0,5).'.min.'.$type;
				if (!is_file($public_path.$filename) ||
					(filemtime($path)>filemtime($public_path.$filename))) {
					$min = $this->f3->call($this->f3->get('ASSETS.minify.compiler.'.$type),
						[$path_parts['basename'],$path_parts['dirname'].'/']);
					if ($type=='css')
						$min = $this->fixRelativePaths($min,
							$path_parts['dirname'].'/',$public_path);
					$this->f3->write($public_path.$filename,$min);
				}
				$asset['path'] = $public_path.$filename;
			}
			unset($asset);
		}
		if (!empty($inline_stack)) {
			foreach ($inline_stack as $slotGroup=>$inlineData) {
				$data = implode($inlineData);
				if ($this->f3->get('ASSETS.minify.inline')) {
					// this is probably pretty slow
					$hash = $this->f3->hash($data);
					$filename = $hash.'.min.'.$type;
					if (!is_file($public_path.$filename)) {
						$this->f3->write($public_path.$filename,$data);
						$min = \Web::instance()->minify($filename,null,false,
							$public_path);
						$this->f3->write($public_path.$filename,$min);
					}
					$collection[] = array(
						'path'=>$public_path.$filename,
						'type'=>$type,
						'origin'=>'internal',
						'slot'=>$slotGroup,
					);
				} else {
					$collection[] = array(
						'data'=>$data,
						'type'=>$type,
						'origin'=>'inline',
						'slot'=>$slotGroup,
					);
				}
			}
		}
		return $collection;
	}