Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
BaseInfoRetriever
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 retrieveBatch
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2namespace MediaWiki\IPInfo\InfoRetriever;
3
4use MediaWiki\User\UserIdentity;
5
6abstract class BaseInfoRetriever implements InfoRetriever {
7
8    /**
9     * Retrieve IP information for a set of IPs associated with a temporary user.
10     * This is a default implementation that simply retrieves the information sequentially.
11     *
12     * @param UserIdentity $user
13     * @param string[] $ips The IP addresses to retrieve information for, in human-readable form.
14     * @return array Map of IP information keyed by IP address.
15     */
16    public function retrieveBatch( UserIdentity $user, array $ips ): array {
17        $infoMap = [];
18
19        foreach ( $ips as $ip ) {
20            $infoMap[$ip] = $this->retrieveFor( $user, $ip );
21        }
22
23        return $infoMap;
24    }
25}