Debian Codegraph @

includes/skins/components/SkinComponentLogo.php

raw symbols SCIP
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 * http://www.gnu.org/copyleft/gpl.html
17 */
18
19 namespace MediaWiki\Skin;
20
21 use MediaWiki\Config\Config;
22 use MediaWiki\Language\Language;
23 use MediaWiki\ResourceLoader as RL;
24
25 /**
26 * @internal for use inside Skin and SkinTemplate classes only
27 * @unstable
28 */
29 class SkinComponentLogo implements SkinComponent {
30 /** @var Config */
31 private $config;
32 /** @var string|null */
33 private $language;
34
35 /**
36 * @param Config $config
37 * @param Language $language
38 */
39 public function __construct( Config $config, Language $language ) {
40 $this->config = $config;
41 $this->language = $language->getCode();
42 }
43
44 /**
45 * @return string|null
46 */
47 private function getLanguage(): ?string {
48 return $this->language;
49 }
50
51 /**
52 * @return Config
53 */
54 private function getConfig(): Config {
55 return $this->config;
56 }
57
58 /**
59 * @inheritDoc
60 * Since 1.35 (all fields optional):
61 * - string 1x Path to a square icon at 1x resolution
62 * - string 2x Path to a square icon at 2x resolution
63 * - string icon Path to a square icon
64 * - array wordmark with `src`, `width`, `height` and `style` keys.
65 * - array tagline with `src`, `width`, `height` and `style` keys.
66 */
67 public function getTemplateData(): array {
68 return RL\SkinModule::getAvailableLogos( $this->getConfig(), $this->getLanguage() );
69 }
70 }