Get list of MongoId objects from array of strings, MongoId's and Document's

@param array $list
@return array list of \MongoId
340577
public static function mixedToMongoIdList(array $list)
    {
        return array_map(function ($element) {
            // MongoId
            if ($element instanceof \MongoId) {
                return $element;
            }

            // \Sokil\Mongo\Document
            if ($element instanceof Document) {
                return $element->getId();
            }

            // array with id key
            if (is_array($element)) {
                if (!isset($element['_id'])) {
                    throw new \InvalidArgumentException('Array must have _id key');
                }
                return $element['_id'];
            }

            // string
            if (is_string($element)) {
                try {
                    return new \MongoId($element);
                } catch (\MongoException $e) {
                    return $element;
                }
            }

            // int
            if (is_int($element)) {
                return $element;
            }

            throw new \InvalidArgumentException(
                'Must be \MongoId, \Sokil\Mongo\Document, array with _id key, string or integer'
            );
        }, array_values($list));
    }
974549
public static function ol($list, $attributes = array())
    {
        $html = self::getInstance()->html;
        $args = func_get_args();
        return call_user_func_array(array($html, __FUNCTION__), $args);
    }
298391
protected function _formArrayFromList($oList)
    {
        $aData = array();
        foreach ($oList as $sKey => $object) {
            $aData[$sKey] = $this->_getObjectFieldValues($object);
        }

        return $aData;
    }
1178801
protected function filter(array $list)
    {
        $tmp = [];
        foreach ($list as $item) {
            if ($item['anime']) {
                $tmp[] = $item;
            }
        }
        return $tmp;
    }
80764
protected function parse(array $list)
    {
        $parsed = array();

        foreach ($list as $item) {
            $item = explode(';', trim($item));

            $entry = array(
                'encoding' => array_shift($item),
                'q' => 1
            );

            foreach ($item as $param) {
                $param = explode('=', $param);

                // ignore malformed params
                if (count($param) != 2) {
                    continue;
                }

                $entry[$param[0]] = $param[1];
            }

            $parsed[] = $entry;
        }

        return $parsed;
    }
1369764
public function getList($list)
	{
		$filteredList = [];

		foreach (explode(',', $list) as $item)
		{
			if ($item != '')
			{
				$filteredList[] = $item;
			}
		}

		return $filteredList;
	}
489008
public static function pregSplitArray(array $list, string $pattern): array
    {
        $slices = [];
        $index = -1;
        foreach ($list as $value) {
            if (preg_match($pattern, $value) === 1) {
                ++$index;
            }

            if ($index !== -1) {
                $slices[$index][] = $value;
            }
        }

        return $slices;
    }
970278
public function backendListArrayToMultiAssocArray(stdClass $list)
    {
        $ret = array();

        if ( isset($list->ArrayOfString) ) {
            foreach ( $list->ArrayOfString as $a ) {
                if ( is_array($a) ) {      // 1 template only
                    $o         = new StdClass();
                    $o->string = $a;
                } else {                 // 2 or more templates
                    $o = $a;
                }
                unset($a);

                if ( isset($o->string) ) {
                    $date1 = DateTime::createFromFormat(DateTime::RFC1123 , $o->string[ 3 ]);
                    $date2 = DateTime::createFromFormat(DateTime::RFC1123 , $o->string[ 1 ]);
                    $ret[] = array(
                        'filename'   => $o->string[ 0 ] ,
                        'fileSize'   => ( integer ) $o->string[ 2 ] ,
                        'createTime' => ( integer ) $date1->getTimestamp() ,
                        'modifyTime' => ( integer ) $date2->getTimestamp() ,
                    );
                    unset($date1 , $date2);
                }
            }
        }

        return $ret;
    }
690151
protected function listToString($list)
    {
        if (is_array($list)) {
            if (count($list) > 1) {
                $listLast = array_pop($list);
                $listBeforeLast = array_pop($list);
                array_push($list, $listBeforeLast . ' ' . $this->t('and') . ' ' . $listLast);
            }
        } else {
            $list = array($list);
        }
        return implode(', ', $list);
    }
145709
public function findIn(array $list)
    {
        $list_string = '';
        foreach ($list as $node_id) {
            $list_string .= $node_id.',';
        }

        $list_string = substr($list_string, 0, strlen($list_string) - 1); // обрезка послезней запятой.

        if (false == $list_string) {
            return [];
        }

        return $this->_em->createQuery("
            SELECT n
            FROM CMSBundle:Node AS n
            WHERE n.id IN({$list_string})
            ORDER BY n.position ASC
        ")->getResult();
    }
946957
public function getList(array $module)
    {
        $list = array();

        foreach ($this->getScanFolders() as $folder) {
            $files = gplcart_file_scan_recursive("{$module['directory']}/$folder");
            sort($files);
            $list[$folder] = $files;
        }

        $this->hook->attach('module.editor.list', $list);
        return $list;
    }
105715
private function validateList(array $list)
    {
        foreach ($list as $rule) {
            if (!$this->validateRule($rule)) {
                return false;
            }
        }

        return true;
    }
1361477
function(count){
      var result = [];

      if (count)
        for (var objectId in this.items_)
          if (result.push(this.items_[objectId]) >= count)
            break;

      return result;
    }
184379
public function convert(array $list): array
    {
        $result = [];
        foreach ($this->mapping as $modelKeyName => $jsonKeyName) {
            $result[$modelKeyName] = $list[$jsonKeyName];
        }

        return $result;
    }
568373
protected function sortByPriority(array $list) : array
    {
        $nonPriorityItems = [];
        $priorityItems = [];

        foreach ($list as $key => $priority) {
            if ($priority == -1) {
                $nonPriorityItems[] = $key;
            } else {
                $priorityItems[$key] = $priority;
            }
        }

        asort($priorityItems);

        return array_merge(array_keys($priorityItems), $nonPriorityItems);
    }
1051143
public function getList($conditions = []) {
		$conditions += ['status' => 1];
		$res = $this->find('all', ['conditions' => $conditions, 'fields' => ['id', 'name']]);
		$ret = [];
		foreach ($res as $language) {
			$ret[$language['id']] = $language['name'];
		}
		return $ret;
	}
720949
protected function cleanSrcList($list)
    {
        $dirs = array_get($list, 'directories');
        $files = array_get($list, 'files');
        $path = array_get($list, 'path');
        $node = array_get($list, 'node');

        foreach ($dirs as $key => $dir) {
            $dirs[$key] = [
                'name' => $dir,
                'path' => $path,
                'type' => 'dir',
                'node' => $node
            ];
        }

        foreach ($files as $key => $file) {
            $name = array_get($file, 'path');
            $files[$key]['name'] = $name;
            $files[$key]['type'] = 'file';
            $files[$key]['node'] = $node;
        }

        return array_merge($dirs, $files);
    }