Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 29
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
ExtensionDependencyError
0.00% covered (danger)
0.00%
0 / 29
0.00% covered (danger)
0.00%
0 / 1
110
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 29
0.00% covered (danger)
0.00%
0 / 1
110
1<?php
2/**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * @file
18 */
19
20/**
21 * @newable
22 * @since 1.31
23 * @ingroup ExtensionRegistry
24 * @author Kunal Mehta <legoktm@debian.org>
25 */
26class ExtensionDependencyError extends Exception {
27
28    /**
29     * @var string[]
30     */
31    public $missingExtensions = [];
32
33    /**
34     * @var string[]
35     */
36    public $missingSkins = [];
37
38    /**
39     * @var string[]
40     */
41    public $incompatibleExtensions = [];
42
43    /**
44     * @var string[]
45     */
46    public $incompatibleSkins = [];
47
48    /**
49     * @var bool
50     */
51    public $incompatibleCore = false;
52
53    /**
54     * @var bool
55     */
56    public $incompatiblePhp = false;
57
58    /**
59     * @var string[]
60     */
61    public $missingPhpExtensions = [];
62
63    /**
64     * @var string[]
65     */
66    public $missingAbilities = [];
67
68    /**
69     * @param array[] $errors Each error has a 'msg' and 'type' key at minimum
70     */
71    public function __construct( array $errors ) {
72        $msg = '';
73        foreach ( $errors as $info ) {
74            $msg .= $info['msg'] . "\n";
75            switch ( $info['type'] ) {
76                case 'incompatible-core':
77                    $this->incompatibleCore = true;
78                    break;
79                case 'incompatible-php':
80                    $this->incompatiblePhp = true;
81                    break;
82                case 'missing-phpExtension':
83                    $this->missingPhpExtensions[] = $info['missing'];
84                    break;
85                case 'missing-ability':
86                    $this->missingAbilities[] = $info['missing'];
87                    break;
88                case 'missing-skins':
89                    $this->missingSkins[] = $info['missing'];
90                    break;
91                case 'missing-extensions':
92                    $this->missingExtensions[] = $info['missing'];
93                    break;
94                case 'incompatible-skins':
95                    $this->incompatibleSkins[] = $info['incompatible'];
96                    break;
97                case 'incompatible-extensions':
98                    $this->incompatibleExtensions[] = $info['incompatible'];
99                    break;
100                // default: continue
101            }
102        }
103
104        parent::__construct( $msg );
105    }
106
107}