@param array $list

@return float
168689
private function evaluateList(array $list): float
    {
        if (empty($list)) {
            return 1;
        }

        $hit = 0;
        foreach ($list as $line) {
            if (preg_match('/<a\s+href=([\'"]?)([^"\'\s]+)\1/isu', $line)) {
                $hit++;
            }
        }

        return 9 * (1.0 * $hit / count($list)) ** 2 + 1;
    }
727464
private function finish($list)
    {
        if (is_array($list) || ($list instanceof ArrayObject)) {
            foreach ($list as $index => $item) {
                $list[$index] = $this->finish($item);
            }

            if ($list instanceof ArrayObject) {
                $list = $list->getArrayCopy();
            }
        } elseif (is_object($list)) {
            $list->values = $this->finish($list->values);
        }

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

        return $result;
    }
735360
protected function prepareListOrderAccount(array &$list)
    {
        foreach ($list as &$item) {
            $this->setItemTotalFormatted($item, $this->price);
            $this->setItemOrderAddress($item, $this->address);
            $this->setItemOrderStoreName($item, $this->store);
            $this->setItemOrderStatusName($item, $this->order);
            $this->setItemOrderPaymentName($item, $this->payment);
            $this->setItemOrderShippingName($item, $this->shipping);
        }
    }
865960
protected static function prepare_list($list) {
        global $OUTPUT;
        $foldericon = $OUTPUT->image_url(file_folder_icon(24))->out(false);

        // Reset the array keys because non-numeric keys will create an object when converted to JSON.
        $list = array_values($list);

        $len = count($list);
        for ($i = 0; $i < $len; $i++) {
            if (is_object($list[$i])) {
                $file = (array)$list[$i];
                $converttoobject = true;
            } else {
                $file =& $list[$i];
                $converttoobject = false;
            }

            if (isset($file['source'])) {
                $file['sourcekey'] = sha1($file['source'] . self::get_secret_key() . sesskey());
            }

            if (isset($file['size'])) {
                $file['size'] = (int)$file['size'];
                $file['size_f'] = display_size($file['size']);
            }
            if (isset($file['license']) && get_string_manager()->string_exists($file['license'], 'license')) {
                $file['license_f'] = get_string($file['license'], 'license');
            }
            if (isset($file['image_width']) && isset($file['image_height'])) {
                $a = array('width' => $file['image_width'], 'height' => $file['image_height']);
                $file['dimensions'] = get_string('imagesize', 'repository', (object)$a);
            }
            foreach (array('date', 'datemodified', 'datecreated') as $key) {
                if (!isset($file[$key]) && isset($file['date'])) {
                    $file[$key] = $file['date'];
                }
                if (isset($file[$key])) {
                    // must be UNIX timestamp
                    $file[$key] = (int)$file[$key];
                    if (!$file[$key]) {
                        unset($file[$key]);
                    } else {
                        $file[$key.'_f'] = userdate($file[$key], get_string('strftimedatetime', 'langconfig'));
                        $file[$key.'_f_s'] = userdate($file[$key], get_string('strftimedatetimeshort', 'langconfig'));
                    }
                }
            }
            $isfolder = (array_key_exists('children', $file) || (isset($file['type']) && $file['type'] == 'folder'));
            $filename = null;
            if (isset($file['title'])) {
                $filename = $file['title'];
            }
            else if (isset($file['fullname'])) {
                $filename = $file['fullname'];
            }
            if (!isset($file['mimetype']) && !$isfolder && $filename) {
                $file['mimetype'] = get_mimetype_description(array('filename' => $filename));
            }
            if (!isset($file['icon'])) {
                if ($isfolder) {
                    $file['icon'] = $foldericon;
                } else if ($filename) {
                    $file['icon'] = $OUTPUT->image_url(file_extension_icon($filename, 24))->out(false);
                }
            }

            // Recursively loop over children.
            if (isset($file['children'])) {
                $file['children'] = self::prepare_list($file['children']);
            }

            // Convert the array back to an object.
            if ($converttoobject) {
                $list[$i] = (object)$file;
            }
        }
        return $list;
    }
807127
public function compute(array $a, array $b) : float
    {
        $deltas = [];

        foreach ($a as $i => $value) {
            $deltas[] = abs($value - $b[$i]);
        }

        return max($deltas);
    }
927289
public function fromArray( array $list )
	{
		$unknown = array();
		$list = parent::fromArray( $list );

		foreach( $list as $key => $value )
		{
			switch( $key )
			{
				case 'order.base.address.baseid': $this->setBaseId( $value ); break;
				case 'order.base.address.addressid': $this->setAddressId( $value ); break;
				case 'order.base.address.type': $this->setType( $value ); break;
				default: $unknown[$key] = $value;
			}
		}

		return $unknown;
	}
1178801
protected function filter(array $list)
    {
        $tmp = [];
        foreach ($list as $item) {
            if ($item['anime']) {
                $tmp[] = $item;
            }
        }
        return $tmp;
    }
1358447
public function checkIn($value, $list)
    {
        // List is passed as second parameter or with many single parameters
        $args = func_get_args();
        array_shift($args); // remove $value

        $items = count($args) > 1 ? $args : (array)$list;

        return in_array($value, $items);
    }
734502
private function sortableResetArray($list)
    {
        $removedKeys = array_keys($this->baseConcreteData);
        foreach ($list as $index => $value) {
            $this[$index] = $value;
            if (($key = array_search($index, $removedKeys)) !== false) {
                unset($removedKeys[$key]);
            }
        }
        unset($list);
        foreach ($removedKeys as $index) {
            unset($this[$index]);
        }
        if (method_exists($this, 'rewind')) {
            $this->rewind();
        }
    }
863000
public static function sumOfSquares(array $numbers): float
    {
        if (count($numbers) === 0) {
            throw new InvalidArgumentException('The array has zero elements');
        }

        $mean = Mean::arithmetic($numbers);

        return array_sum(array_map(
            function ($val) use ($mean) {
                return ($val - $mean) ** 2;
            },
            $numbers
        ));
    }
530398
public function contains(array $list)
    {
        phpCAS::traceBegin();
        $count = 0;
        foreach ($this->_chains as $chain) {
            phpCAS::trace("Checking chain ". $count++);
            if ($chain->matches($list)) {
                phpCAS::traceEnd(true);
                return true;
            }
        }
        phpCAS::trace("No proxy chain matches.");
        phpCAS::traceEnd(false);
        return false;
    }
951853
public function insertObjects($table, $list) {
		
		if (!is_array($list) or 0==count($list)) {
			return 0;
		}
		
		$records = array();
		$fields  = array();
		
		foreach ($list as $object) {

			$values = array();
		
			foreach (get_object_vars($object) as $k => $v) {
				
				if (!count($records))	{
					$fields[] = '`' . $k . '`';
				}
				
				$values[] = is_null($v) ? 'NULL' : $this->quote($v);

			}

			$records[] = '('. implode(',', $values) .')';
			
		}
		
		$sql = 'INSERT INTO `'. $table .'` (%s) VALUES %s';

		$this->query = sprintf($sql, implode(',', $fields), implode(',', $records));

		$res = $this->exec($this->query);

		return $res;
		
	}
1094781
public function fromArray( array $list )
	{
		if( array_key_exists( $this->_prefix . 'id', $list ) )
		{
			$this->setId( $list[$this->_prefix . 'id'] );
			unset( $list[$this->_prefix . 'id'] );
		}

		unset( $list[$this->_prefix . 'siteid'] );
		unset( $list[$this->_prefix . 'ctime'] );
		unset( $list[$this->_prefix . 'mtime'] );
		unset( $list[$this->_prefix . 'editor'] );

		return $list;
	}
1005680
public function mung(array $list)
    {
        foreach ($list as $value) {
            if (false === in_array($value, self::$allowedMung)) {
                throw InvalidArgumentException::create(
                    'The $_SERVER variable "%s" is not allowed.',
                    $value
                );
            }
        }

        $this->mung = $list;

        return $this;
    }
89879
public static function sort($list)
	{
		for( $i=sizeof( $list ) - 1; $i>=1; $i-- )
			for( $j=0; $j<$i; $j++ )
				if( $list[$j] > $list[$j+1] ) 
					self::swap( $list, $j, $j + 1 );
		return $list;
	}
976057
protected function prepareList(array $list)
    {
        foreach ($list as &$item) {
            $item['fields'] = $this->getFieldValues($item['combination_id']);
        }

        return $list;
    }