Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3/**
4 * Copyright (c) 2011 Patrick Reilly
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * http://www.gnu.org/copyleft/gpl.html
20 *
21 * @file
22 */
23
24namespace MobileFrontend\Devices;
25
26use MediaWiki\Request\WebRequest;
27
28/**
29 * Detects the properties of the device that's making the request on behalf of
30 * the user.
31 *
32 * @see DeviceProperties
33 */
34interface DeviceDetector {
35
36    /**
37     * Report, if possible, the properties of the device that's being used to
38     * access the wiki.
39     *
40     * Because `WebRequest` doesn't currently provide read-only access to the
41     * `$_SERVER` superglobal within its API, it's expected to be passed as
42     * additional context.
43     *
44     * @param WebRequest $request for the current page view. The HTTP headers of this request
45     *  will be used to determine whether the page view should redirect to mobile
46     * @param array $server Per the above, the `$_SERVER` superglobal
47     * @return DeviceProperties|null
48     */
49    public function detectDeviceProperties( WebRequest $request, array $server );
50}