diff --git a/Maps.i18n.alias.php b/Maps.i18n.alias.php index 3375ac8e2..0c89dec3c 100644 --- a/Maps.i18n.alias.php +++ b/Maps.i18n.alias.php @@ -1,129 +1,129 @@ array( 'MapEditor' ), -); +$specialPageAliases['en'] = [ + 'MapEditor' => [ 'MapEditor' ], +]; /** Arabic (العربية) */ -$specialPageAliases['ar'] = array( - 'MapEditor' => array( 'محرر_الخريطة' ), -); +$specialPageAliases['ar'] = [ + 'MapEditor' => [ 'محرر_الخريطة' ], +]; /** Egyptian Arabic (مصرى) */ -$specialPageAliases['arz'] = array( - 'MapEditor' => array( 'محرر_الخريطه' ), -); +$specialPageAliases['arz'] = [ + 'MapEditor' => [ 'محرر_الخريطه' ], +]; /** Assamese (অসমীয়া) */ -$specialPageAliases['as'] = array( - 'MapEditor' => array( 'মানচিত্ৰ_সম্পাদক' ), -); +$specialPageAliases['as'] = [ + 'MapEditor' => [ 'মানচিত্ৰ_সম্পাদক' ], +]; /** Western Balochi (بلوچی رخشانی) */ -$specialPageAliases['bgn'] = array( - 'MapEditor' => array( 'نخشه_ئی_ایڈیٹگر' ), -); +$specialPageAliases['bgn'] = [ + 'MapEditor' => [ 'نخشه_ئی_ایڈیٹگر' ], +]; /** German (Deutsch) */ -$specialPageAliases['de'] = array( - 'MapEditor' => array( 'Karteneditor' ), -); +$specialPageAliases['de'] = [ + 'MapEditor' => [ 'Karteneditor' ], +]; /** Zazaki (Zazaki) */ -$specialPageAliases['diq'] = array( - 'MapEditor' => array( 'VırneréXerita' ), -); +$specialPageAliases['diq'] = [ + 'MapEditor' => [ 'VırneréXerita' ], +]; /** Greek (Ελληνικά) */ -$specialPageAliases['el'] = array( - 'MapEditor' => array( 'ΕπεξεργαστήςΧαρτών' ), -); +$specialPageAliases['el'] = [ + 'MapEditor' => [ 'ΕπεξεργαστήςΧαρτών' ], +]; /** Persian (فارسی) */ -$specialPageAliases['fa'] = array( - 'MapEditor' => array( 'ویرایشگر_نقشه' ), -); +$specialPageAliases['fa'] = [ + 'MapEditor' => [ 'ویرایشگر_نقشه' ], +]; /** Galician (galego) */ -$specialPageAliases['gl'] = array( - 'MapEditor' => array( 'Editor_do_mapa' ), -); +$specialPageAliases['gl'] = [ + 'MapEditor' => [ 'Editor_do_mapa' ], +]; /** Hebrew (עברית) */ -$specialPageAliases['he'] = array( - 'MapEditor' => array( 'עורך_מפה' ), -); +$specialPageAliases['he'] = [ + 'MapEditor' => [ 'עורך_מפה' ], +]; /** Upper Sorbian (hornjoserbsce) */ -$specialPageAliases['hsb'] = array( - 'MapEditor' => array( 'Kartowy_editor' ), -); +$specialPageAliases['hsb'] = [ + 'MapEditor' => [ 'Kartowy_editor' ], +]; /** Italian (italiano) */ -$specialPageAliases['it'] = array( - 'MapEditor' => array( 'EditorMappa' ), -); +$specialPageAliases['it'] = [ + 'MapEditor' => [ 'EditorMappa' ], +]; /** Japanese (日本語) */ -$specialPageAliases['ja'] = array( - 'MapEditor' => array( '地図編集', 'マップ編集' ), -); +$specialPageAliases['ja'] = [ + 'MapEditor' => [ '地図編集', 'マップ編集' ], +]; /** Korean (한국어) */ -$specialPageAliases['ko'] = array( - 'MapEditor' => array( '지도편집기' ), -); +$specialPageAliases['ko'] = [ + 'MapEditor' => [ '지도편집기' ], +]; /** Luxembourgish (Lëtzebuergesch) */ -$specialPageAliases['lb'] = array( - 'MapEditor' => array( 'Kaartenediteur' ), -); +$specialPageAliases['lb'] = [ + 'MapEditor' => [ 'Kaartenediteur' ], +]; /** Macedonian (македонски) */ -$specialPageAliases['mk'] = array( - 'MapEditor' => array( 'УредникНаКарти' ), -); +$specialPageAliases['mk'] = [ + 'MapEditor' => [ 'УредникНаКарти' ], +]; /** Malayalam (മലയാളം) */ -$specialPageAliases['ml'] = array( - 'MapEditor' => array( 'ഭൂപടതിരുത്തലുപാധി' ), -); +$specialPageAliases['ml'] = [ + 'MapEditor' => [ 'ഭൂപടതിരുത്തലുപാധി' ], +]; /** Dutch (Nederlands) */ -$specialPageAliases['nl'] = array( - 'MapEditor' => array( 'Kaarteditor' ), -); +$specialPageAliases['nl'] = [ + 'MapEditor' => [ 'Kaarteditor' ], +]; /** Sicilian (sicilianu) */ -$specialPageAliases['scn'] = array( - 'MapEditor' => array( 'EditorMappa' ), -); +$specialPageAliases['scn'] = [ + 'MapEditor' => [ 'EditorMappa' ], +]; /** Turkish (Türkçe) */ -$specialPageAliases['tr'] = array( - 'MapEditor' => array( 'HaritaDüzenleyici', 'HaritaEditörü' ), -); +$specialPageAliases['tr'] = [ + 'MapEditor' => [ 'HaritaDüzenleyici', 'HaritaEditörü' ], +]; /** Vietnamese (Tiếng Việt) */ -$specialPageAliases['vi'] = array( - 'MapEditor' => array( 'Sửa_đổi_bản_đồ' ), -); +$specialPageAliases['vi'] = [ + 'MapEditor' => [ 'Sửa_đổi_bản_đồ' ], +]; /** Simplified Chinese (中文(简体)‎) */ -$specialPageAliases['zh-hans'] = array( - 'MapEditor' => array( '地图编辑器' ), -); +$specialPageAliases['zh-hans'] = [ + 'MapEditor' => [ '地图编辑器' ], +]; /** Traditional Chinese (中文(繁體)‎) */ -$specialPageAliases['zh-hant'] = array( - 'MapEditor' => array( '地圖編輯器' ), -); \ No newline at end of file +$specialPageAliases['zh-hant'] = [ + 'MapEditor' => [ '地圖編輯器' ], +]; \ No newline at end of file diff --git a/Maps.i18n.magic.php b/Maps.i18n.magic.php index f572ac17b..b7065cee7 100644 --- a/Maps.i18n.magic.php +++ b/Maps.i18n.magic.php @@ -4,384 +4,384 @@ * Internationalisation file for Maps extension. */ -$magicWords = array(); +$magicWords = []; /** English (English) */ -$magicWords['en'] = array( - 'display_map' => array( 0, 'display_map' ), - 'display_point' => array( 0, 'display_point' ), - 'display_points' => array( 0, 'display_points' ), - 'display_line' => array( 0, 'display_line' ), - 'geocode' => array( 0, 'geocode' ), - 'geodistance' => array( 0, 'geodistance' ), - 'finddestination' => array( 0, 'finddestination' ), - 'coordinates' => array( 0, 'coordinates' ), - 'distance' => array( 0, 'distance' ), - 'mapsdoc' => array( 0, 'mapsdoc' ), -); +$magicWords['en'] = [ + 'display_map' => [ 0, 'display_map' ], + 'display_point' => [ 0, 'display_point' ], + 'display_points' => [ 0, 'display_points' ], + 'display_line' => [ 0, 'display_line' ], + 'geocode' => [ 0, 'geocode' ], + 'geodistance' => [ 0, 'geodistance' ], + 'finddestination' => [ 0, 'finddestination' ], + 'coordinates' => [ 0, 'coordinates' ], + 'distance' => [ 0, 'distance' ], + 'mapsdoc' => [ 0, 'mapsdoc' ], +]; /** Afrikaans (Afrikaans) */ -$magicWords['af'] = array( - 'geocode' => array( 0, 'geokode', 'geocode' ), - 'coordinates' => array( 0, 'koördinate', 'coordinates' ), -); +$magicWords['af'] = [ + 'geocode' => [ 0, 'geokode', 'geocode' ], + 'coordinates' => [ 0, 'koördinate', 'coordinates' ], +]; /** Arabic (العربية) */ -$magicWords['ar'] = array( - 'display_map' => array( 0, 'عرض_الخريطة' ), - 'display_point' => array( 0, 'نقطة_العرض' ), - 'display_points' => array( 0, 'نقاط_العرض' ), - 'display_line' => array( 0, 'خط_العرض' ), - 'geocode' => array( 0, 'كود_جغرافي' ), - 'geodistance' => array( 0, 'مسافة_جغرافية' ), - 'finddestination' => array( 0, 'إيجاد_الوجهة' ), - 'coordinates' => array( 0, 'إحداثيات' ), - 'distance' => array( 0, 'مسافة' ), - 'mapsdoc' => array( 0, 'توثيق_الخرائط' ), -); +$magicWords['ar'] = [ + 'display_map' => [ 0, 'عرض_الخريطة' ], + 'display_point' => [ 0, 'نقطة_العرض' ], + 'display_points' => [ 0, 'نقاط_العرض' ], + 'display_line' => [ 0, 'خط_العرض' ], + 'geocode' => [ 0, 'كود_جغرافي' ], + 'geodistance' => [ 0, 'مسافة_جغرافية' ], + 'finddestination' => [ 0, 'إيجاد_الوجهة' ], + 'coordinates' => [ 0, 'إحداثيات' ], + 'distance' => [ 0, 'مسافة' ], + 'mapsdoc' => [ 0, 'توثيق_الخرائط' ], +]; /** Egyptian Arabic (مصرى) */ -$magicWords['arz'] = array( - 'display_map' => array( 0, 'عرض_الخريطه', 'عرض_الخريطة' ), - 'display_point' => array( 0, 'نقطه_العرض' ), - 'display_points' => array( 0, 'نقط_العرض' ), - 'display_line' => array( 0, 'خط_العرض' ), - 'geocode' => array( 0, 'كود_جغرافي' ), - 'geodistance' => array( 0, 'مسافه_جغرافيه', 'مسافة_جغرافية' ), - 'finddestination' => array( 0, 'إيجاد_الوجهه', 'إيجاد_الوجهة' ), - 'coordinates' => array( 0, 'إحداثيات' ), - 'distance' => array( 0, 'مسافه' ), - 'mapsdoc' => array( 0, 'توثيق_الخرايط' ), -); +$magicWords['arz'] = [ + 'display_map' => [ 0, 'عرض_الخريطه', 'عرض_الخريطة' ], + 'display_point' => [ 0, 'نقطه_العرض' ], + 'display_points' => [ 0, 'نقط_العرض' ], + 'display_line' => [ 0, 'خط_العرض' ], + 'geocode' => [ 0, 'كود_جغرافي' ], + 'geodistance' => [ 0, 'مسافه_جغرافيه', 'مسافة_جغرافية' ], + 'finddestination' => [ 0, 'إيجاد_الوجهه', 'إيجاد_الوجهة' ], + 'coordinates' => [ 0, 'إحداثيات' ], + 'distance' => [ 0, 'مسافه' ], + 'mapsdoc' => [ 0, 'توثيق_الخرايط' ], +]; /** Assamese (অসমীয়া) */ -$magicWords['as'] = array( - 'display_point' => array( 0, 'মানচিত্ৰ_প্ৰদৰ্শন' ), -); +$magicWords['as'] = [ + 'display_point' => [ 0, 'মানচিত্ৰ_প্ৰদৰ্শন' ], +]; /** Breton (brezhoneg) */ -$magicWords['br'] = array( - 'coordinates' => array( 0, 'daveennoù' ), - 'distance' => array( 0, 'hed' ), -); +$magicWords['br'] = [ + 'coordinates' => [ 0, 'daveennoù' ], + 'distance' => [ 0, 'hed' ], +]; /** Chechen (нохчийн) */ -$magicWords['ce'] = array( - 'geocode' => array( 0, 'геагишар', 'геокод' ), -); +$magicWords['ce'] = [ + 'geocode' => [ 0, 'геагишар', 'геокод' ], +]; /** German (Deutsch) */ -$magicWords['de'] = array( - 'display_map' => array( 0, 'zeige_karte' ), - 'display_point' => array( 0, 'zeige_punkt' ), - 'display_points' => array( 0, 'zeige_punkte' ), - 'display_line' => array( 0, 'zeige_linie' ), - 'geocode' => array( 0, 'geokodiere' ), - 'geodistance' => array( 0, 'geoentfernung' ), - 'finddestination' => array( 0, 'finde_ziel' ), - 'coordinates' => array( 0, 'koordinaten' ), - 'distance' => array( 0, 'entfernung' ), - 'mapsdoc' => array( 0, 'mapsdok' ), -); +$magicWords['de'] = [ + 'display_map' => [ 0, 'zeige_karte' ], + 'display_point' => [ 0, 'zeige_punkt' ], + 'display_points' => [ 0, 'zeige_punkte' ], + 'display_line' => [ 0, 'zeige_linie' ], + 'geocode' => [ 0, 'geokodiere' ], + 'geodistance' => [ 0, 'geoentfernung' ], + 'finddestination' => [ 0, 'finde_ziel' ], + 'coordinates' => [ 0, 'koordinaten' ], + 'distance' => [ 0, 'entfernung' ], + 'mapsdoc' => [ 0, 'mapsdok' ], +]; /** Zazaki (Zazaki) */ -$magicWords['diq'] = array( - 'display_map' => array( 0, 'aseniya_ğerita' ), - 'display_point' => array( 0, 'aseniya_dewti' ), - 'display_points' => array( 0, 'aseniya_dawıtan' ), - 'display_line' => array( 0, 'aseniya_ğeter' ), - 'geocode' => array( 0, 'herunkodi' ), - 'geodistance' => array( 0, 'heruna_mesafi' ), - 'finddestination' => array( 0, 'menzilvinayış' ), - 'coordinates' => array( 0, 'koordinati' ), - 'distance' => array( 0, 'mesafe' ), - 'mapsdoc' => array( 0, 'dokumanéğerita' ), -); +$magicWords['diq'] = [ + 'display_map' => [ 0, 'aseniya_ğerita' ], + 'display_point' => [ 0, 'aseniya_dewti' ], + 'display_points' => [ 0, 'aseniya_dawıtan' ], + 'display_line' => [ 0, 'aseniya_ğeter' ], + 'geocode' => [ 0, 'herunkodi' ], + 'geodistance' => [ 0, 'heruna_mesafi' ], + 'finddestination' => [ 0, 'menzilvinayış' ], + 'coordinates' => [ 0, 'koordinati' ], + 'distance' => [ 0, 'mesafe' ], + 'mapsdoc' => [ 0, 'dokumanéğerita' ], +]; /** Esperanto (Esperanto) */ -$magicWords['eo'] = array( - 'coordinates' => array( 0, 'koordinatoj' ), - 'distance' => array( 0, 'distanco' ), -); +$magicWords['eo'] = [ + 'coordinates' => [ 0, 'koordinatoj' ], + 'distance' => [ 0, 'distanco' ], +]; /** Spanish (español) */ -$magicWords['es'] = array( - 'display_point' => array( 0, 'mostrar_punto' ), - 'geocode' => array( 0, 'geocodificar' ), - 'coordinates' => array( 0, 'coordenadas' ), - 'distance' => array( 0, 'distancia' ), -); +$magicWords['es'] = [ + 'display_point' => [ 0, 'mostrar_punto' ], + 'geocode' => [ 0, 'geocodificar' ], + 'coordinates' => [ 0, 'coordenadas' ], + 'distance' => [ 0, 'distancia' ], +]; /** French (français) */ -$magicWords['fr'] = array( - 'display_map' => array( 0, 'afficher_carte' ), - 'display_point' => array( 0, 'afficher_point' ), - 'display_points' => array( 0, 'afficher_points' ), - 'display_line' => array( 0, 'afficher_ligne' ), - 'geocode' => array( 0, 'codegéo' ), - 'geodistance' => array( 0, 'distancegéo' ), - 'finddestination' => array( 0, 'trouverdestination' ), - 'coordinates' => array( 0, 'coordonnées' ), - 'distance' => array( 0, 'distance' ), - 'mapsdoc' => array( 0, 'doccartes' ), -); +$magicWords['fr'] = [ + 'display_map' => [ 0, 'afficher_carte' ], + 'display_point' => [ 0, 'afficher_point' ], + 'display_points' => [ 0, 'afficher_points' ], + 'display_line' => [ 0, 'afficher_ligne' ], + 'geocode' => [ 0, 'codegéo' ], + 'geodistance' => [ 0, 'distancegéo' ], + 'finddestination' => [ 0, 'trouverdestination' ], + 'coordinates' => [ 0, 'coordonnées' ], + 'distance' => [ 0, 'distance' ], + 'mapsdoc' => [ 0, 'doccartes' ], +]; /** Hebrew (עברית) */ -$magicWords['he'] = array( - 'distance' => array( 0, 'מרחק' ), -); +$magicWords['he'] = [ + 'distance' => [ 0, 'מרחק' ], +]; /** Indonesian (Bahasa Indonesia) */ -$magicWords['id'] = array( - 'finddestination' => array( 0, 'petunjukarah' ), - 'coordinates' => array( 0, 'koordinat' ), - 'distance' => array( 0, 'jarak' ), -); +$magicWords['id'] = [ + 'finddestination' => [ 0, 'petunjukarah' ], + 'coordinates' => [ 0, 'koordinat' ], + 'distance' => [ 0, 'jarak' ], +]; /** Igbo (Igbo) */ -$magicWords['ig'] = array( - 'display_map' => array( 0, 'zí_otúzọr', 'display_map' ), -); +$magicWords['ig'] = [ + 'display_map' => [ 0, 'zí_otúzọr', 'display_map' ], +]; /** Italian (italiano) */ -$magicWords['it'] = array( - 'display_map' => array( 0, 'mostra_mappa' ), - 'display_point' => array( 0, 'mostra_punto' ), - 'display_points' => array( 0, 'mostra_punti' ), - 'geocode' => array( 0, 'geocodice' ), - 'geodistance' => array( 0, 'geodistanza' ), - 'finddestination' => array( 0, 'trovadestinazione' ), - 'coordinates' => array( 0, 'coordinate' ), - 'distance' => array( 0, 'distanza' ), - 'mapsdoc' => array( 0, 'docmappe' ), -); +$magicWords['it'] = [ + 'display_map' => [ 0, 'mostra_mappa' ], + 'display_point' => [ 0, 'mostra_punto' ], + 'display_points' => [ 0, 'mostra_punti' ], + 'geocode' => [ 0, 'geocodice' ], + 'geodistance' => [ 0, 'geodistanza' ], + 'finddestination' => [ 0, 'trovadestinazione' ], + 'coordinates' => [ 0, 'coordinate' ], + 'distance' => [ 0, 'distanza' ], + 'mapsdoc' => [ 0, 'docmappe' ], +]; /** Japanese (日本語) */ -$magicWords['ja'] = array( - 'display_map' => array( 0, '地図表示' ), - 'display_point' => array( 0, '地図点' ), - 'geocode' => array( 0, '地理的コード' ), - 'geodistance' => array( 0, '地理的距離' ), - 'finddestination' => array( 0, '目的地検索' ), - 'coordinates' => array( 0, '座標' ), - 'distance' => array( 0, '距離' ), -); +$magicWords['ja'] = [ + 'display_map' => [ 0, '地図表示' ], + 'display_point' => [ 0, '地図点' ], + 'geocode' => [ 0, '地理的コード' ], + 'geodistance' => [ 0, '地理的距離' ], + 'finddestination' => [ 0, '目的地検索' ], + 'coordinates' => [ 0, '座標' ], + 'distance' => [ 0, '距離' ], +]; /** Georgian (ქართული) */ -$magicWords['ka'] = array( - 'coordinates' => array( 0, 'კოორდინატები' ), - 'distance' => array( 0, 'მანძილი' ), -); +$magicWords['ka'] = [ + 'coordinates' => [ 0, 'კოორდინატები' ], + 'distance' => [ 0, 'მანძილი' ], +]; /** Korean (한국어) */ -$magicWords['ko'] = array( - 'display_map' => array( 0, '지도_표시' ), - 'display_point' => array( 0, '포인트_표시' ), - 'display_points' => array( 0, '포인트목록_표시' ), - 'display_line' => array( 0, '선_표시' ), - 'geocode' => array( 0, '지리코드' ), - 'geodistance' => array( 0, '지리거리' ), - 'finddestination' => array( 0, '목적지찾기' ), - 'coordinates' => array( 0, '좌표' ), - 'distance' => array( 0, '거리' ), - 'mapsdoc' => array( 0, '지도문서' ), -); +$magicWords['ko'] = [ + 'display_map' => [ 0, '지도_표시' ], + 'display_point' => [ 0, '포인트_표시' ], + 'display_points' => [ 0, '포인트목록_표시' ], + 'display_line' => [ 0, '선_표시' ], + 'geocode' => [ 0, '지리코드' ], + 'geodistance' => [ 0, '지리거리' ], + 'finddestination' => [ 0, '목적지찾기' ], + 'coordinates' => [ 0, '좌표' ], + 'distance' => [ 0, '거리' ], + 'mapsdoc' => [ 0, '지도문서' ], +]; /** Kurdish (Latin script) (Kurdî (latînî)‎) */ -$magicWords['ku-latn'] = array( - 'coordinates' => array( 0, 'koordînat' ), -); +$magicWords['ku-latn'] = [ + 'coordinates' => [ 0, 'koordînat' ], +]; /** Ladino (Ladino) */ -$magicWords['lad'] = array( - 'distance' => array( 0, 'distancia', 'distance' ), -); +$magicWords['lad'] = [ + 'distance' => [ 0, 'distancia', 'distance' ], +]; /** Luxembourgish (Lëtzebuergesch) */ -$magicWords['lb'] = array( - 'coordinates' => array( 0, 'Koordinaten' ), - 'distance' => array( 0, 'Distanz' ), -); +$magicWords['lb'] = [ + 'coordinates' => [ 0, 'Koordinaten' ], + 'distance' => [ 0, 'Distanz' ], +]; /** Minangkabau (Baso Minangkabau) */ -$magicWords['min'] = array( - 'finddestination' => array( 0, 'petunjukarah' ), - 'coordinates' => array( 0, 'koordinat' ), - 'distance' => array( 0, 'jarak' ), -); +$magicWords['min'] = [ + 'finddestination' => [ 0, 'petunjukarah' ], + 'coordinates' => [ 0, 'koordinat' ], + 'distance' => [ 0, 'jarak' ], +]; /** Macedonian (македонски) */ -$magicWords['mk'] = array( - 'display_map' => array( 0, 'прикажи_карта' ), - 'display_point' => array( 0, 'прикажи_точка' ), - 'display_points' => array( 0, 'прикажи_точки' ), - 'display_line' => array( 0, 'прикажи_линија' ), - 'geocode' => array( 0, 'геокод' ), - 'geodistance' => array( 0, 'георастојание' ), - 'finddestination' => array( 0, 'најдиодредница' ), - 'coordinates' => array( 0, 'координати' ), - 'distance' => array( 0, 'растојание' ), - 'mapsdoc' => array( 0, 'докумкарти' ), -); +$magicWords['mk'] = [ + 'display_map' => [ 0, 'прикажи_карта' ], + 'display_point' => [ 0, 'прикажи_точка' ], + 'display_points' => [ 0, 'прикажи_точки' ], + 'display_line' => [ 0, 'прикажи_линија' ], + 'geocode' => [ 0, 'геокод' ], + 'geodistance' => [ 0, 'георастојание' ], + 'finddestination' => [ 0, 'најдиодредница' ], + 'coordinates' => [ 0, 'координати' ], + 'distance' => [ 0, 'растојание' ], + 'mapsdoc' => [ 0, 'докумкарти' ], +]; /** Malayalam (മലയാളം) */ -$magicWords['ml'] = array( - 'display_map' => array( 0, 'ഭൂപടം_പ്രദർശിപ്പിക്കുക' ), - 'display_point' => array( 0, 'ബിന്ദു_പ്രദർശിപ്പിക്കുക' ), - 'display_points' => array( 0, 'ബിന്ദുക്കൾ_പ്രദർശിപ്പിക്കുക' ), - 'display_line' => array( 0, 'രേഖ_പ്രദർശിപ്പിക്കുക' ), - 'geocode' => array( 0, 'ജിയോകോഡ്' ), - 'geodistance' => array( 0, 'ഭൗമദൂരം' ), - 'finddestination' => array( 0, 'ലക്ഷ്യംതിരയുക' ), - 'coordinates' => array( 0, 'നിർദ്ദേശാങ്കങ്ങൾ' ), - 'distance' => array( 0, 'ദൂരം' ), -); +$magicWords['ml'] = [ + 'display_map' => [ 0, 'ഭൂപടം_പ്രദർശിപ്പിക്കുക' ], + 'display_point' => [ 0, 'ബിന്ദു_പ്രദർശിപ്പിക്കുക' ], + 'display_points' => [ 0, 'ബിന്ദുക്കൾ_പ്രദർശിപ്പിക്കുക' ], + 'display_line' => [ 0, 'രേഖ_പ്രദർശിപ്പിക്കുക' ], + 'geocode' => [ 0, 'ജിയോകോഡ്' ], + 'geodistance' => [ 0, 'ഭൗമദൂരം' ], + 'finddestination' => [ 0, 'ലക്ഷ്യംതിരയുക' ], + 'coordinates' => [ 0, 'നിർദ്ദേശാങ്കങ്ങൾ' ], + 'distance' => [ 0, 'ദൂരം' ], +]; /** Marathi (मराठी) */ -$magicWords['mr'] = array( - 'distance' => array( 0, 'अंतर' ), -); +$magicWords['mr'] = [ + 'distance' => [ 0, 'अंतर' ], +]; /** Low Saxon (Netherlands) (Nedersaksies) */ -$magicWords['nds-nl'] = array( - 'display_map' => array( 0, 'kaorte_laoten_zien' ), - 'geocode' => array( 0, 'geokoderen' ), - 'geodistance' => array( 0, 'geo-aofstaand' ), - 'finddestination' => array( 0, 'bestemmingzeuken' ), - 'coordinates' => array( 0, 'koordinaoten' ), - 'distance' => array( 0, 'aofstaand' ), -); +$magicWords['nds-nl'] = [ + 'display_map' => [ 0, 'kaorte_laoten_zien' ], + 'geocode' => [ 0, 'geokoderen' ], + 'geodistance' => [ 0, 'geo-aofstaand' ], + 'finddestination' => [ 0, 'bestemmingzeuken' ], + 'coordinates' => [ 0, 'koordinaoten' ], + 'distance' => [ 0, 'aofstaand' ], +]; /** Dutch (Nederlands) */ -$magicWords['nl'] = array( - 'display_map' => array( 0, 'kaart_weergeven' ), - 'display_point' => array( 0, 'punt_weergeven' ), - 'display_points' => array( 0, 'punten_weergeven' ), - 'display_line' => array( 0, 'lijn_weergeven' ), - 'geocode' => array( 0, 'geocoderen' ), - 'geodistance' => array( 0, 'geoafstand' ), - 'finddestination' => array( 0, 'bestemmingzoeken' ), - 'coordinates' => array( 0, 'coordinaten' ), - 'distance' => array( 0, 'afstand' ), - 'mapsdoc' => array( 0, 'kaartdoc' ), -); +$magicWords['nl'] = [ + 'display_map' => [ 0, 'kaart_weergeven' ], + 'display_point' => [ 0, 'punt_weergeven' ], + 'display_points' => [ 0, 'punten_weergeven' ], + 'display_line' => [ 0, 'lijn_weergeven' ], + 'geocode' => [ 0, 'geocoderen' ], + 'geodistance' => [ 0, 'geoafstand' ], + 'finddestination' => [ 0, 'bestemmingzoeken' ], + 'coordinates' => [ 0, 'coordinaten' ], + 'distance' => [ 0, 'afstand' ], + 'mapsdoc' => [ 0, 'kaartdoc' ], +]; /** Polish (polski) */ -$magicWords['pl'] = array( - 'display_map' => array( 0, 'wyświetl_mapę' ), - 'coordinates' => array( 0, 'współrzędne' ), - 'distance' => array( 0, 'odległość' ), -); +$magicWords['pl'] = [ + 'display_map' => [ 0, 'wyświetl_mapę' ], + 'coordinates' => [ 0, 'współrzędne' ], + 'distance' => [ 0, 'odległość' ], +]; /** Pashto (پښتو) */ -$magicWords['ps'] = array( - 'distance' => array( 0, 'واټن', 'distance' ), -); +$magicWords['ps'] = [ + 'distance' => [ 0, 'واټن', 'distance' ], +]; /** Portuguese (português) */ -$magicWords['pt'] = array( - 'display_map' => array( 0, 'mostrar_mapa' ), - 'display_point' => array( 0, 'mostrar_ponto' ), - 'display_points' => array( 0, 'mostrar_pontos' ), - 'geocode' => array( 0, 'geocódigo' ), - 'geodistance' => array( 0, 'geodistância' ), - 'finddestination' => array( 0, 'encontrardestino' ), - 'coordinates' => array( 0, 'coordenadas' ), - 'distance' => array( 0, 'distância' ), -); +$magicWords['pt'] = [ + 'display_map' => [ 0, 'mostrar_mapa' ], + 'display_point' => [ 0, 'mostrar_ponto' ], + 'display_points' => [ 0, 'mostrar_pontos' ], + 'geocode' => [ 0, 'geocódigo' ], + 'geodistance' => [ 0, 'geodistância' ], + 'finddestination' => [ 0, 'encontrardestino' ], + 'coordinates' => [ 0, 'coordenadas' ], + 'distance' => [ 0, 'distância' ], +]; /** Russian (русский) */ -$magicWords['ru'] = array( - 'display_map' => array( 0, 'показать_карту' ), - 'display_point' => array( 0, 'показать_точку' ), - 'display_points' => array( 0, 'показать_точки' ), - 'display_line' => array( 0, 'показать_линию' ), - 'geocode' => array( 0, 'геокод' ), - 'geodistance' => array( 0, 'георасстояние' ), - 'finddestination' => array( 0, 'найти_местоположение' ), - 'coordinates' => array( 0, 'координаты' ), - 'distance' => array( 0, 'расстояние' ), -); +$magicWords['ru'] = [ + 'display_map' => [ 0, 'показать_карту' ], + 'display_point' => [ 0, 'показать_точку' ], + 'display_points' => [ 0, 'показать_точки' ], + 'display_line' => [ 0, 'показать_линию' ], + 'geocode' => [ 0, 'геокод' ], + 'geodistance' => [ 0, 'георасстояние' ], + 'finddestination' => [ 0, 'найти_местоположение' ], + 'coordinates' => [ 0, 'координаты' ], + 'distance' => [ 0, 'расстояние' ], +]; /** Sinhala (සිංහල) */ -$magicWords['si'] = array( - 'finddestination' => array( 0, 'ගමනාන්තය_සෙවීම', 'finddestination' ), - 'coordinates' => array( 0, 'ඛණ්ඩාංක', 'coordinates' ), - 'distance' => array( 0, 'දුර', 'distance' ), -); +$magicWords['si'] = [ + 'finddestination' => [ 0, 'ගමනාන්තය_සෙවීම', 'finddestination' ], + 'coordinates' => [ 0, 'ඛණ්ඩාංක', 'coordinates' ], + 'distance' => [ 0, 'දුර', 'distance' ], +]; /** Serbian (Cyrillic script) (српски (ћирилица)‎) */ -$magicWords['sr-ec'] = array( - 'display_map' => array( 0, 'прикажи_мапу' ), - 'display_point' => array( 0, 'прикажи_тачку', 'прикажи_тачке' ), - 'finddestination' => array( 0, 'пронађиодредиште', 'пронађи_одредиште' ), - 'coordinates' => array( 0, 'координате' ), - 'distance' => array( 0, 'раздаљина' ), -); +$magicWords['sr-ec'] = [ + 'display_map' => [ 0, 'прикажи_мапу' ], + 'display_point' => [ 0, 'прикажи_тачку', 'прикажи_тачке' ], + 'finddestination' => [ 0, 'пронађиодредиште', 'пронађи_одредиште' ], + 'coordinates' => [ 0, 'координате' ], + 'distance' => [ 0, 'раздаљина' ], +]; /** Serbian (Latin script) (srpski (latinica)‎) */ -$magicWords['sr-el'] = array( - 'display_map' => array( 0, 'prikaži_mapu' ), - 'display_point' => array( 0, 'prikaži_tačku', 'prikaži_tačke' ), - 'geocode' => array( 0, 'geografski_kod' ), - 'geodistance' => array( 0, 'geografska_razdaljina' ), - 'finddestination' => array( 0, 'pronađi_odredište' ), - 'coordinates' => array( 0, 'koordinate' ), - 'distance' => array( 0, 'razdaljina' ), -); +$magicWords['sr-el'] = [ + 'display_map' => [ 0, 'prikaži_mapu' ], + 'display_point' => [ 0, 'prikaži_tačku', 'prikaži_tačke' ], + 'geocode' => [ 0, 'geografski_kod' ], + 'geodistance' => [ 0, 'geografska_razdaljina' ], + 'finddestination' => [ 0, 'pronađi_odredište' ], + 'coordinates' => [ 0, 'koordinate' ], + 'distance' => [ 0, 'razdaljina' ], +]; /** Talysh (толышә зывон) */ -$magicWords['tly'] = array( - 'display_map' => array( 0, 'хәритә_нишо_дој' ), -); +$magicWords['tly'] = [ + 'display_map' => [ 0, 'хәритә_нишо_дој' ], +]; /** Ukrainian (українська) */ -$magicWords['uk'] = array( - 'display_map' => array( 0, 'показати_карту' ), - 'display_point' => array( 0, 'показати_точку' ), - 'display_points' => array( 0, 'показати_точки' ), - 'geodistance' => array( 0, 'геовідстань' ), - 'finddestination' => array( 0, 'знайти_місцезнаходження' ), - 'coordinates' => array( 0, 'координати' ), - 'distance' => array( 0, 'відстань' ), -); +$magicWords['uk'] = [ + 'display_map' => [ 0, 'показати_карту' ], + 'display_point' => [ 0, 'показати_точку' ], + 'display_points' => [ 0, 'показати_точки' ], + 'geodistance' => [ 0, 'геовідстань' ], + 'finddestination' => [ 0, 'знайти_місцезнаходження' ], + 'coordinates' => [ 0, 'координати' ], + 'distance' => [ 0, 'відстань' ], +]; /** Uzbek (oʻzbekcha/ўзбекча) */ -$magicWords['uz'] = array( - 'coordinates' => array( 0, 'koordinatalar' ), -); +$magicWords['uz'] = [ + 'coordinates' => [ 0, 'koordinatalar' ], +]; /** Vietnamese (Tiếng Việt) */ -$magicWords['vi'] = array( - 'display_map' => array( 0, 'hiển_thị_bản_đồ', 'hiểnthịbảnđồ' ), - 'geocode' => array( 0, 'mã_hóa_địa_lý', 'mãhóađịalý', 'mã_hoá_địa_lý', 'mãhoáđịalý', 'mã_hóa_địa_lí', 'mãhóađịalí', 'mã_hoá_địa_lí', 'mãhoáđịalí' ), - 'coordinates' => array( 0, 'tọa_độ', 'tọađộ' ), -); +$magicWords['vi'] = [ + 'display_map' => [ 0, 'hiển_thị_bản_đồ', 'hiểnthịbảnđồ' ], + 'geocode' => [ 0, 'mã_hóa_địa_lý', 'mãhóađịalý', 'mã_hoá_địa_lý', 'mãhoáđịalý', 'mã_hóa_địa_lí', 'mãhóađịalí', 'mã_hoá_địa_lí', 'mãhoáđịalí' ], + 'coordinates' => [ 0, 'tọa_độ', 'tọađộ' ], +]; /** Simplified Chinese (中文(简体)‎) */ -$magicWords['zh-hans'] = array( - 'display_map' => array( 0, '显示地图' ), - 'display_point' => array( 0, '显示点' ), - 'display_points' => array( 0, '显示多个点' ), - 'display_line' => array( 0, '显示线' ), - 'geocode' => array( 0, '地理编码' ), - 'geodistance' => array( 0, '地理距离' ), - 'finddestination' => array( 0, '寻找目的地' ), - 'coordinates' => array( 0, '坐标' ), - 'distance' => array( 0, '距离' ), - 'mapsdoc' => array( 0, '地图文档' ), -); +$magicWords['zh-hans'] = [ + 'display_map' => [ 0, '显示地图' ], + 'display_point' => [ 0, '显示点' ], + 'display_points' => [ 0, '显示多个点' ], + 'display_line' => [ 0, '显示线' ], + 'geocode' => [ 0, '地理编码' ], + 'geodistance' => [ 0, '地理距离' ], + 'finddestination' => [ 0, '寻找目的地' ], + 'coordinates' => [ 0, '坐标' ], + 'distance' => [ 0, '距离' ], + 'mapsdoc' => [ 0, '地图文档' ], +]; /** Traditional Chinese (中文(繁體)‎) */ -$magicWords['zh-hant'] = array( - 'display_map' => array( 0, '顯示地圖' ), - 'display_point' => array( 0, '顯示位置' ), - 'display_points' => array( 0, '顯示多個位置' ), - 'display_line' => array( 0, '顯示線' ), - 'geocode' => array( 0, '地理編碼' ), - 'geodistance' => array( 0, '地理距離' ), - 'finddestination' => array( 0, '搜尋目的地' ), - 'coordinates' => array( 0, '坐標' ), - 'distance' => array( 0, '距離' ), - 'mapsdoc' => array( 0, '地圖檔案' ), -); \ No newline at end of file +$magicWords['zh-hant'] = [ + 'display_map' => [ 0, '顯示地圖' ], + 'display_point' => [ 0, '顯示位置' ], + 'display_points' => [ 0, '顯示多個位置' ], + 'display_line' => [ 0, '顯示線' ], + 'geocode' => [ 0, '地理編碼' ], + 'geodistance' => [ 0, '地理距離' ], + 'finddestination' => [ 0, '搜尋目的地' ], + 'coordinates' => [ 0, '坐標' ], + 'distance' => [ 0, '距離' ], + 'mapsdoc' => [ 0, '地圖檔案' ], +]; \ No newline at end of file diff --git a/Maps.i18n.namespaces.php b/Maps.i18n.namespaces.php index 893d9dee1..430afa145 100644 --- a/Maps.i18n.namespaces.php +++ b/Maps.i18n.namespaces.php @@ -1,6 +1,6 @@ 'Layer', Maps_NS_LAYER_TALK => 'Layer_talk', -); +]; -$namespaceNames['de'] = array( +$namespaceNames['de'] = [ Maps_NS_LAYER_TALK => 'Layer_Diskussion', -); +]; diff --git a/Maps.i18n.php b/Maps.i18n.php index eeb2776d6..5d045ccd5 100644 --- a/Maps.i18n.php +++ b/Maps.i18n.php @@ -10,9 +10,9 @@ * * This shim maintains compatibility back to MediaWiki 1.17. */ -$messages = array(); +$messages = []; $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = function ( $cache, $code, &$cachedData ) { - $codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] ); + $codeSequence = array_merge( [ $code ], $cachedData['fallbackSequence'] ); foreach ( $codeSequence as $csCode ) { $fileName = __DIR__ . "/i18n/$csCode.json"; if ( is_readable( $fileName ) ) { diff --git a/Maps.php b/Maps.php index 9b905769f..c67802bc7 100644 --- a/Maps.php +++ b/Maps.php @@ -39,18 +39,18 @@ } call_user_func( function() { - $GLOBALS['wgExtensionCredits']['parserhook'][] = array( + $GLOBALS['wgExtensionCredits']['parserhook'][] = [ 'path' => __FILE__ , 'name' => 'Maps' , 'version' => Maps_VERSION , - 'author' => array( + 'author' => [ '[https://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]', '...' - ) , + ] , 'url' => 'https://github.com/JeroenDeDauw/Maps/blob/master/README.md#maps' , 'descriptionmsg' => 'maps-desc', 'license-name' => 'GPL-2.0+' - ); + ]; // The different coordinate notations. define( 'Maps_COORDS_FLOAT' , 'float' ); @@ -190,43 +190,43 @@ } } - $GLOBALS['wgParamDefinitions']['coordinate'] = array( + $GLOBALS['wgParamDefinitions']['coordinate'] = [ 'string-parser' => 'DataValues\Geo\Parsers\GeoCoordinateParser', - ); + ]; - $GLOBALS['wgParamDefinitions']['mappingservice'] = array( + $GLOBALS['wgParamDefinitions']['mappingservice'] = [ 'definition'=> 'Maps\ServiceParam', - ); + ]; - $GLOBALS['wgParamDefinitions']['mapslocation'] = array( + $GLOBALS['wgParamDefinitions']['mapslocation'] = [ 'string-parser' => 'Maps\LocationParser', - ); + ]; - $GLOBALS['wgParamDefinitions']['mapsline'] = array( + $GLOBALS['wgParamDefinitions']['mapsline'] = [ 'string-parser' => 'Maps\LineParser', - ); + ]; - $GLOBALS['wgParamDefinitions']['mapscircle'] = array( + $GLOBALS['wgParamDefinitions']['mapscircle'] = [ 'string-parser' => 'Maps\CircleParser', - ); + ]; - $GLOBALS['wgParamDefinitions']['mapsrectangle'] = array( + $GLOBALS['wgParamDefinitions']['mapsrectangle'] = [ 'string-parser' => 'Maps\RectangleParser', - ); + ]; - $GLOBALS['wgParamDefinitions']['mapspolygon'] = array( + $GLOBALS['wgParamDefinitions']['mapspolygon'] = [ 'string-parser' => 'Maps\PolygonParser', - ); + ]; - $GLOBALS['wgParamDefinitions']['distance'] = array( + $GLOBALS['wgParamDefinitions']['distance'] = [ 'string-parser' => 'Maps\DistanceParser', - ); + ]; - $GLOBALS['wgParamDefinitions']['wmsoverlay'] = array( + $GLOBALS['wgParamDefinitions']['wmsoverlay'] = [ 'string-parser' => 'Maps\WmsOverlayParser', - ); + ]; - $GLOBALS['wgParamDefinitions']['mapsimageoverlay'] = array( + $GLOBALS['wgParamDefinitions']['mapsimageoverlay'] = [ 'string-parser' => 'Maps\ImageOverlayParser', - ); + ]; } ); diff --git a/Maps.resources.php b/Maps.resources.php index 13f052299..3e8d8a441 100644 --- a/Maps.resources.php +++ b/Maps.resources.php @@ -15,60 +15,60 @@ $pathParts = ( explode( DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR, __DIR__, 2 ) ); - $moduleTemplate = array( + $moduleTemplate = [ 'position' => 'top', 'localBasePath' => __DIR__ . '/includes', 'remoteExtPath' => end( $pathParts ) . '/includes', 'group' => 'ext.maps', - 'targets' => array( + 'targets' => [ 'mobile', 'desktop' - ) - ); + ] + ]; - return array( - 'ext.maps.common' => $moduleTemplate + array( - 'messages' => array( + return [ + 'ext.maps.common' => $moduleTemplate + [ + 'messages' => [ 'maps-load-failed', - ) , - 'scripts' => array( + ] , + 'scripts' => [ 'ext.maps.common.js', - ), - ), + ], + ], - 'ext.maps.layers' => $moduleTemplate + array( - 'styles' => array( + 'ext.maps.layers' => $moduleTemplate + [ + 'styles' => [ 'ext.maps.layers.css' - ) - ), + ] + ], - 'ext.maps.coord' => $moduleTemplate + array( - 'messages' => array( + 'ext.maps.coord' => $moduleTemplate + [ + 'messages' => [ 'maps-abb-north', 'maps-abb-east', 'maps-abb-south', 'maps-abb-west', - ), - 'scripts' => array( + ], + 'scripts' => [ 'ext.maps.coord.js' - ), - ), + ], + ], - 'ext.maps.resizable' => $moduleTemplate + array( + 'ext.maps.resizable' => $moduleTemplate + [ 'dependencies' => 'jquery.ui.resizable', - ), + ], - 'mapeditor' => $moduleTemplate + array( - 'scripts' => array( + 'mapeditor' => $moduleTemplate + [ + 'scripts' => [ 'editor/js/jquery.miniColors.js', 'editor/js/mapeditor.iefixes.js', 'editor/js/mapeditor.js', - ), - 'styles' => array( + ], + 'styles' => [ 'editor/css/jquery.miniColors.css', 'editor/css/mapeditor.css', - ), - 'messages' => array( + ], + 'messages' => [ 'mapeditor-parser-error', 'mapeditor-none-text', 'mapeditor-done-button', @@ -80,27 +80,27 @@ 'mapeditor-mapparam-button', 'mapeditor-clear-button', 'mapeditor-imageoverlay-button', - ), - 'dependencies' => array( + ], + 'dependencies' => [ 'ext.maps.common', 'jquery.ui.autocomplete', 'jquery.ui.slider', 'jquery.ui.dialog', - ), - ), + ], + ], - 'ext.maps.services' => $moduleTemplate + array( + 'ext.maps.services' => $moduleTemplate + [ 'group' => 'ext.maps', - 'scripts' => array( + 'scripts' => [ 'ext.maps.services.js', - ), - 'dependencies' => array( + ], + 'dependencies' => [ 'ext.maps.common', 'ext.maps.layers', 'ext.maps.coord' - ) - ) - ); + ] + ] + ]; } ); // @codeCoverageIgnoreEnd diff --git a/Maps_Settings.php b/Maps_Settings.php index c8de195a3..c9a5c9d5d 100644 --- a/Maps_Settings.php +++ b/Maps_Settings.php @@ -17,11 +17,11 @@ // Mapping services configuration // Array of String. Array containing all the mapping services that will be made available to the user. - $GLOBALS['egMapsAvailableServices'] = array( + $GLOBALS['egMapsAvailableServices'] = [ 'googlemaps3', 'openlayers', 'leaflet', - ); + ]; // String. The default mapping service, which will be used when no default // service is present in the $GLOBALS['egMapsDefaultServices'] array for a certain feature. @@ -34,9 +34,9 @@ // enabled, if not, the first one from the available services will be taken. // Note: The default service needs to be available for the feature you set it // for, since it's used as a fallback mechanism. - $GLOBALS['egMapsDefaultServices'] = array( + $GLOBALS['egMapsDefaultServices'] = [ 'display_map' => $GLOBALS['egMapsDefaultService'], - ); + ]; // Geocoding @@ -47,11 +47,11 @@ // at http://www.geonames.org/login and set the username to $GLOBALS['egMapsGeoNamesUser'] below. // Not doing this will result into a legacy service being used, which might be // disabled at some future point. - $GLOBALS['egMapsAvailableGeoServices'] = array( + $GLOBALS['egMapsAvailableGeoServices'] = [ 'geonames', 'google', 'geocoderus', - ); + ]; // String. The default geocoding service, which will be used when no service is // is provided by the user. This service needs to be enabled, if not, the first @@ -77,12 +77,12 @@ // Coordinate configuration // The coordinate notations that should be available. - $GLOBALS['egMapsAvailableCoordNotations'] = array( + $GLOBALS['egMapsAvailableCoordNotations'] = [ Maps_COORDS_FLOAT, Maps_COORDS_DMS, Maps_COORDS_DM, Maps_COORDS_DD - ); + ]; // Enum. The default output format of coordinates. // Possible values: Maps_COORDS_FLOAT, Maps_COORDS_DMS, Maps_COORDS_DM, Maps_COORDS_DD @@ -101,7 +101,7 @@ // Array. A list of units (keys) and how many meters they represent (value). // No spaces! If the unit consists out of multiple words, just write them together. - $GLOBALS['egMapsDistanceUnits'] = array( + $GLOBALS['egMapsDistanceUnits'] = [ 'm' => 1, 'meter' => 1, 'meters' => 1, @@ -114,7 +114,7 @@ 'nm' => 1852, 'nauticalmile' => 1852, 'nauticalmiles' => 1852, - ); + ]; // String. The default unit for distances. $GLOBALS['egMapsDistanceUnit'] = 'm'; @@ -134,10 +134,10 @@ // max for absolute values, then min and max for percentage values. When the // height or width exceed their limits, they will be changed to the closest // allowed value. - $GLOBALS['egMapsSizeRestrictions'] = array( - 'width' => array( 50, 1020, 1, 100 ), - 'height' => array( 50, 1000, 1, 100 ), - ); + $GLOBALS['egMapsSizeRestrictions'] = [ + 'width' => [ 50, 1020, 1, 100 ], + 'height' => [ 50, 1000, 1, 100 ], + ]; // String. The default centre for maps. Can be either a set of coordinates or an address. $GLOBALS['egMapsDefaultMapCentre'] = '0, 0'; @@ -177,25 +177,25 @@ // Array of String. The Google Maps v3 default map types. This value will only // be used when the user does not provide one. - $GLOBALS['egMapsGMaps3Types'] = array( + $GLOBALS['egMapsGMaps3Types'] = [ 'roadmap', 'satellite', 'hybrid', 'terrain' - ); + ]; // String. The default map type. This value will only be used when the user // does not provide one. $GLOBALS['egMapsGMaps3Type'] = 'roadmap'; // Array. List of controls to display onto maps by default. - $GLOBALS['egMapsGMaps3Controls'] = array( + $GLOBALS['egMapsGMaps3Controls'] = [ 'pan', 'zoom', 'type', 'scale', 'streetview' - ); + ]; // String. The default style for the type control. // horizontal, vertical or default @@ -210,7 +210,7 @@ // Array. Layers to load by default. // traffic and bicycling - $GLOBALS['egMapsGMaps3Layers'] = array(); + $GLOBALS['egMapsGMaps3Layers'] = []; // Integer. Default tilt when using Google Maps. $GLOBALS['egMapsGMaps3DefaultTilt'] = 0; @@ -231,64 +231,64 @@ // be used when the user does not provide one. // Available values: layerswitcher, mouseposition, autopanzoom, panzoom, // panzoombar, scaleline, navigation, keyboarddefaults, overviewmap, permalink - $GLOBALS['egMapsOLControls'] = array( + $GLOBALS['egMapsOLControls'] = [ 'layerswitcher', 'mouseposition', 'autopanzoom', 'scaleline', 'navigation' - ); + ]; // Array of String. The default layers for Open Layers. This value will only be // used when the user does not provide one. - $GLOBALS['egMapsOLLayers'] = array( + $GLOBALS['egMapsOLLayers'] = [ 'osm-mapnik', 'osm-cyclemap' - ); + ]; // The difinitions for the layers that should be available for the user. - $GLOBALS['egMapsOLAvailableLayers'] = array( + $GLOBALS['egMapsOLAvailableLayers'] = [ //'google' => array( 'OpenLayers.Layer.Google("Google Streets")' ), - 'bing-normal' => array( 'OpenLayers.Layer.VirtualEarth( "Bing Streets", {type: VEMapStyle.Shaded, "sphericalMercator":true} )', 'bing' ), - 'bing-satellite' => array( 'OpenLayers.Layer.VirtualEarth( "Bing Satellite", {type: VEMapStyle.Aerial, "sphericalMercator":true} )', 'bing' ), - 'bing-hybrid' => array( 'OpenLayers.Layer.VirtualEarth( "Bing Hybrid", {type: VEMapStyle.Hybrid, "sphericalMercator":true} )', 'bing' ), + 'bing-normal' => [ 'OpenLayers.Layer.VirtualEarth( "Bing Streets", {type: VEMapStyle.Shaded, "sphericalMercator":true} )', 'bing' ], + 'bing-satellite' => [ 'OpenLayers.Layer.VirtualEarth( "Bing Satellite", {type: VEMapStyle.Aerial, "sphericalMercator":true} )', 'bing' ], + 'bing-hybrid' => [ 'OpenLayers.Layer.VirtualEarth( "Bing Hybrid", {type: VEMapStyle.Hybrid, "sphericalMercator":true} )', 'bing' ], - 'yahoo-normal' => array( 'OpenLayers.Layer.Yahoo( "Yahoo! Streets", {"sphericalMercator":true} )', 'yahoo' ), - 'yahoo-hybrid' => array( 'OpenLayers.Layer.Yahoo( "Yahoo! Hybrid", {"type": YAHOO_MAP_HYB, "sphericalMercator":true} )', 'yahoo' ), - 'yahoo-satellite' => array( 'OpenLayers.Layer.Yahoo( "Yahoo! Satellite", {"type": YAHOO_MAP_SAT, "sphericalMercator":true} )', 'yahoo' ), + 'yahoo-normal' => [ 'OpenLayers.Layer.Yahoo( "Yahoo! Streets", {"sphericalMercator":true} )', 'yahoo' ], + 'yahoo-hybrid' => [ 'OpenLayers.Layer.Yahoo( "Yahoo! Hybrid", {"type": YAHOO_MAP_HYB, "sphericalMercator":true} )', 'yahoo' ], + 'yahoo-satellite' => [ 'OpenLayers.Layer.Yahoo( "Yahoo! Satellite", {"type": YAHOO_MAP_SAT, "sphericalMercator":true} )', 'yahoo' ], - 'osm-mapnik' => array( 'OpenLayers.Layer.OSM.Mapnik("OSM Mapnik")', 'osm' ), - 'osm-cyclemap' => array( 'OpenLayers.Layer.OSM.CycleMap("OSM Cycle Map")', 'osm' ), - 'osm-mapquest' => array( 'OpenLayers.Layer.OSM.Mapquest("Mapquest OSM")', 'osm' ), + 'osm-mapnik' => [ 'OpenLayers.Layer.OSM.Mapnik("OSM Mapnik")', 'osm' ], + 'osm-cyclemap' => [ 'OpenLayers.Layer.OSM.CycleMap("OSM Cycle Map")', 'osm' ], + 'osm-mapquest' => [ 'OpenLayers.Layer.OSM.Mapquest("Mapquest OSM")', 'osm' ], - 'google-normal' => array( 'OpenLayers.Layer.Google("Google Streets", {type: google.maps.MapTypeId.STREETS, numZoomLevels: 20})', 'google' ), - 'google-satellite' => array( 'OpenLayers.Layer.Google("Google Satellite", {type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22})', 'google' ), - 'google-hybrid' => array( 'OpenLayers.Layer.Google("Google Hybrid", {type: google.maps.MapTypeId.HYBRID, numZoomLevels: 20})', 'google' ), - 'google-terrain' => array( 'OpenLayers.Layer.Google("Google Terrain", {type: google.maps.MapTypeId.TERRAIN, numZoomLevels: 22})', 'google' ), + 'google-normal' => [ 'OpenLayers.Layer.Google("Google Streets", {type: google.maps.MapTypeId.STREETS, numZoomLevels: 20})', 'google' ], + 'google-satellite' => [ 'OpenLayers.Layer.Google("Google Satellite", {type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22})', 'google' ], + 'google-hybrid' => [ 'OpenLayers.Layer.Google("Google Hybrid", {type: google.maps.MapTypeId.HYBRID, numZoomLevels: 20})', 'google' ], + 'google-terrain' => [ 'OpenLayers.Layer.Google("Google Terrain", {type: google.maps.MapTypeId.TERRAIN, numZoomLevels: 22})', 'google' ], 'nasa' => 'OpenLayers.Layer.WMS("NASA Global Mosaic", "http://t1.hypercube.telascience.org/cgi-bin/landsat7", {layers: "landsat7", "sphericalMercator":true} )', - ); + ]; // Layer group definitions. Group names must be different from layer names, and // must only contain layers that are present in $GLOBALS['egMapsOLAvailableLayers']. - $GLOBALS['egMapsOLLayerGroups'] = array( - 'yahoo' => array( 'yahoo-normal', 'yahoo-satellite', 'yahoo-hybrid' ), - 'bing' => array( 'bing-normal', 'bing-satellite', 'bing-hybrid' ), - 'google' => array( 'google-normal', 'google-satellite', 'google-terrain', 'google-hybrid' ), - 'osm' => array( 'osm-mapnik', 'osm-cyclemap' ), - ); + $GLOBALS['egMapsOLLayerGroups'] = [ + 'yahoo' => [ 'yahoo-normal', 'yahoo-satellite', 'yahoo-hybrid' ], + 'bing' => [ 'bing-normal', 'bing-satellite', 'bing-hybrid' ], + 'google' => [ 'google-normal', 'google-satellite', 'google-terrain', 'google-hybrid' ], + 'osm' => [ 'osm-mapnik', 'osm-cyclemap' ], + ]; global $wgJsMimeType; // Layer dependencies - $GLOBALS['egMapsOLLayerDependencies'] = array( + $GLOBALS['egMapsOLLayerDependencies'] = [ 'yahoo' => "", 'bing' => "", 'ol-wms' => "", 'google' => "", - ); + ]; // Leaflet @@ -298,4 +298,4 @@ $GLOBALS['egMapsLeafletZoom'] = 14; -$GLOBALS['egMapsGlobalJSVars'] = array(); +$GLOBALS['egMapsGlobalJSVars'] = []; diff --git a/includes/Element.php b/includes/Element.php index 2725a6c47..d0c1452d7 100644 --- a/includes/Element.php +++ b/includes/Element.php @@ -52,7 +52,7 @@ class OptionsObject { * * @var array */ - protected $options = array(); + protected $options = []; /** * @since 3.0 diff --git a/includes/Geocoder.php b/includes/Geocoder.php index c93aaf829..f12643c2f 100644 --- a/includes/Geocoder.php +++ b/includes/Geocoder.php @@ -130,7 +130,7 @@ public function geocode( $address ) { * @return string or false */ protected static function getXmlElementValue( $xml, $tagName ) { - $match = array(); + $match = []; preg_match( "/<$tagName>(.*?)<\/$tagName>/", $xml, $match ); return count( $match ) > 1 ? $match[1] : false; } @@ -146,7 +146,7 @@ protected static function getXmlElementValue( $xml, $tagName ) { * @return array */ public static function getOverrides() { - return array(); + return []; } /** diff --git a/includes/Geocoders.php b/includes/Geocoders.php index 389fdd00a..408432293 100644 --- a/includes/Geocoders.php +++ b/includes/Geocoders.php @@ -32,7 +32,7 @@ final class Geocoders { * * @var Geocoder[] */ - protected static $geocoders = array(); + protected static $geocoders = []; /** * Associative with geoservice identifiers as keys containing the class @@ -43,7 +43,7 @@ final class Geocoders { * * @var array of string => string */ - public static $registeredGeocoders = array(); + public static $registeredGeocoders = []; /** * The global geocoder cache, holding geocoded data when enabled. @@ -52,7 +52,7 @@ final class Geocoders { * * @var array */ - private static $globalGeocoderCache = array(); + private static $globalGeocoderCache = []; /** * Can geocoding happen, ie are there any geocoders available. @@ -178,11 +178,11 @@ public static function attemptToGeocodeToString( $coordsOrAddress, $service = '' return false; } - $options = new \ValueFormatters\FormatterOptions( array( + $options = new \ValueFormatters\FormatterOptions( [ GeoCoordinateFormatter::OPT_FORMAT => $targetFormat, GeoCoordinateFormatter::OPT_DIRECTIONAL => $directional, GeoCoordinateFormatter::OPT_PRECISION => 1 / 360000 - ) ); + ] ); $formatter = new GeoCoordinateFormatter( $options ); return $formatter->format( $geoCoordinate ); diff --git a/includes/Maps_BaseFillableElement.php b/includes/Maps_BaseFillableElement.php index 09bbffc5a..32f9c01f8 100644 --- a/includes/Maps_BaseFillableElement.php +++ b/includes/Maps_BaseFillableElement.php @@ -34,10 +34,10 @@ public function hasFillOpacity() { public function getJSONObject( $defText = '' , $defTitle = '' ) { $parentArray = parent::getJSONObject( $defText , $defTitle ); - $array = array( + $array = [ 'fillColor' => $this->hasFillColor() ? $this->getFillColor() : '#FF0000' , 'fillOpacity' => $this->hasFillOpacity() ? $this->getFillOpacity() : '0.5' , - ); + ]; return array_merge( $parentArray , $array ); } } diff --git a/includes/Maps_BaseStrokableElement.php b/includes/Maps_BaseStrokableElement.php index 6e7f37258..7b4e0ca5f 100644 --- a/includes/Maps_BaseStrokableElement.php +++ b/includes/Maps_BaseStrokableElement.php @@ -52,11 +52,11 @@ public function hasStrokeWeight() { public function getJSONObject( $defText = '' , $defTitle = '' ) { $parentArray = parent::getJSONObject( $defText , $defTitle ); - $array = array( + $array = [ 'strokeColor' => $this->hasStrokeColor() ? $this->getStrokeColor() : '#FF0000' , 'strokeOpacity' => $this->hasStrokeOpacity() ? $this->getStrokeOpacity() : '1' , 'strokeWeight' => $this->hasStrokeWeight() ? $this->getStrokeWeight() : '2' - ); + ]; return array_merge( $parentArray , $array ); } diff --git a/includes/Maps_DisplayMapRenderer.php b/includes/Maps_DisplayMapRenderer.php index 262fba024..43f5fe45e 100644 --- a/includes/Maps_DisplayMapRenderer.php +++ b/includes/Maps_DisplayMapRenderer.php @@ -42,15 +42,15 @@ public function __construct( iMappingService $service ) { protected function getMapHTML( array $params, Parser $parser, $mapName ) { return Html::rawElement( 'div', - array( + [ 'id' => $mapName, 'style' => "width: {$params['width']}; height: {$params['height']}; background-color: #cccccc; overflow: hidden;", 'class' => 'maps-map maps-' . $this->service->getName() - ), + ], wfMessage( 'maps-loading-map' )->inContentLanguage()->escaped() . Html::element( 'div', - array( 'style' => 'display:none', 'class' => 'mapdata' ), + [ 'style' => 'display:none', 'class' => 'mapdata' ], FormatJson::encode( $this->getJSONObject( $params, $parser ) ) ) ); @@ -118,7 +118,7 @@ protected function handleMarkerData( array &$params, Parser $parser ) { $iconUrl = MapsMapper::getFileUrl( $params['icon'] ); $visitedIconUrl = MapsMapper::getFileUrl( $params['visitedicon'] ); - $params['locations'] = array(); + $params['locations'] = []; /** * @var Location $location @@ -147,13 +147,13 @@ protected function handleMarkerData( array &$params, Parser $parser ) { } protected function handleShapeData( array &$params, Parser $parserClone ) { - $textContainers = array( + $textContainers = [ &$params['lines'] , &$params['polygons'] , &$params['circles'] , &$params['rectangles'], &$params['imageoverlays'], // FIXME: this is Google Maps specific!! - ); + ]; foreach ( $textContainers as &$textContainer ) { if ( is_array( $textContainer ) ) { @@ -189,8 +189,8 @@ protected function handleShapeData( array &$params, Parser $parserClone ) { public static function evilOpenLayersHack( $layers ) { global $egMapsOLLayerGroups, $egMapsOLAvailableLayers; - $layerDefs = array(); - $layerNames = array(); + $layerDefs = []; + $layerNames = []; foreach ( $layers as $layerOrGroup ) { $lcLayerOrGroup = strtolower( $layerOrGroup ); @@ -295,7 +295,7 @@ public static function evilOpenLayersHack( $layers ) { private static function getLayerDependencies( array $layerNames ) { global $egMapsOLLayerDependencies, $egMapsOLAvailableLayers; - $layerDependencies = array(); + $layerDependencies = []; foreach ( $layerNames as $layerName ) { if ( array_key_exists( $layerName, $egMapsOLAvailableLayers ) // The layer must be defined in php diff --git a/includes/Maps_DistanceParser.php b/includes/Maps_DistanceParser.php index d3b906295..fd58bb73f 100644 --- a/includes/Maps_DistanceParser.php +++ b/includes/Maps_DistanceParser.php @@ -34,7 +34,7 @@ public static function parseDistance( $distance ) { self::initUnitRegex(); - $matches = array(); + $matches = []; preg_match( '/^\d+(\.\d+)?\s?(' . self::$unitRegex . ')?$/', $distance, $matches ); $value = (float)( $matches[0] . $matches[1] ); @@ -161,7 +161,7 @@ protected static function normalizeDistance( $distance ) { $strlen = strlen( $distance ); for ( $i = 0; $i < $strlen; $i++ ) { - if ( !ctype_digit( $distance{$i} ) && !in_array( $distance{$i}, array( ',', '.' ) ) ) { + if ( !ctype_digit( $distance{$i} ) && !in_array( $distance{$i}, [ ',', '.' ] ) ) { $value = substr( $distance, 0, $i ); $unit = substr( $distance, $i ); break; @@ -171,7 +171,7 @@ protected static function normalizeDistance( $distance ) { $value = str_replace( ',', '.', isset( $value ) ? $value : $distance ); if ( isset( $unit ) ) { - $value .= ' ' . str_replace( array( ' ', "\t" ), '', $unit ); + $value .= ' ' . str_replace( [ ' ', "\t" ], '', $unit ); } return $value; diff --git a/includes/Maps_GeoFunctions.php b/includes/Maps_GeoFunctions.php index 77696b5f9..94c33dbf1 100644 --- a/includes/Maps_GeoFunctions.php +++ b/includes/Maps_GeoFunctions.php @@ -72,10 +72,10 @@ public static function calculateDistance( LatLongValue $start, LatLongValue $end * @return array The destination coordinates, as non-directional floats in an array with lat and lon keys. */ public static function findDestination( LatLongValue $startingCoordinates, $bearing, $distance ) { - $startingCoordinates = array( + $startingCoordinates = [ 'lat' => deg2rad( $startingCoordinates->getLatitude() ), 'lon' => deg2rad( $startingCoordinates->getLongitude() ), - ); + ]; $radBearing = deg2rad ( (float)$bearing ); $angularDistance = $distance / Maps_EARTH_RADIUS; @@ -83,10 +83,10 @@ public static function findDestination( LatLongValue $startingCoordinates, $bear $lat = asin (sin ( $startingCoordinates['lat'] ) * cos ( $angularDistance ) + cos ( $startingCoordinates['lat'] ) * sin ( $angularDistance ) * cos ( $radBearing ) ); $lon = $startingCoordinates['lon'] + atan2 ( sin ( $radBearing ) * sin ( $angularDistance ) * cos ( $startingCoordinates['lat'] ), cos ( $angularDistance ) - sin ( $startingCoordinates['lat'] ) * sin ( $lat ) ); - return array( + return [ 'lat' => rad2deg( $lat ), 'lon' => rad2deg( $lon ) - ); + ]; } } \ No newline at end of file diff --git a/includes/Maps_KMLFormatter.php b/includes/Maps_KMLFormatter.php index 71acb3ae3..f99244fbe 100644 --- a/includes/Maps_KMLFormatter.php +++ b/includes/Maps_KMLFormatter.php @@ -33,7 +33,7 @@ class MapsKMLFormatter { * * @param array $params */ - public function __construct( array $params = array() ) { + public function __construct( array $params = [] ) { $this->params = $params; $this->clearElements(); } @@ -98,7 +98,7 @@ public function clearElements() { * @since 0.7.3 */ public function clearPlacemarks() { - $this->placemarks = array(); + $this->placemarks = []; } /** @@ -109,7 +109,7 @@ public function clearPlacemarks() { * @return string */ protected function getKMLElements() { - $elements = array(); + $elements = []; $elements = array_merge( $elements, $this->getPlacemarks() ); @@ -125,7 +125,7 @@ protected function getKMLElements() { * @return array */ protected function getPlacemarks() { - $placemarks = array(); + $placemarks = []; foreach ( $this->placemarks as $location ) { $placemarks[] = $this->getKMLForLocation( $location ); @@ -153,7 +153,7 @@ protected function getKMLForLocation( Location $location ) { // lon,lat[,alt] $coordinates = Xml::element( 'coordinates', - array(), + [], $coordinates->getLongitude() . ',' . $coordinates->getLatitude() . ',0' ); diff --git a/includes/Maps_Layer.php b/includes/Maps_Layer.php index 5cbd5b80d..d3600d42a 100644 --- a/includes/Maps_Layer.php +++ b/includes/Maps_Layer.php @@ -42,7 +42,7 @@ public abstract function getJavaScriptDefinition(); * * @var array */ - protected $errors = array(); + protected $errors = []; /** * Keeps track if the layer has been validated, to prevent doing redundant work. @@ -88,7 +88,7 @@ public function __construct( array $properties, $name = null ) { * @return array of string */ public function getErrorMessages( $tag = false ) { - $messages = array(); + $messages = []; foreach ( $this->errors as $error ) { if ( $tag === false || $error->hasTag( $tag ) ) { @@ -223,42 +223,42 @@ public function isOk() { * @return array */ protected function getParameterDefinitions() { - $params = array(); + $params = []; - $params['label'] = array( + $params['label'] = [ 'message' => 'maps-displaymap-par-coordinates', // TODO-customMaps: create a message - ); + ]; // units for extent data: - $params['units'] = array( + $params['units'] = [ 'default' => 'degree', 'message' => 'maps-displaymap-par-coordinates', // TODO-customMaps: create a message - 'values' => array( 'degree', 'm', 'ft', 'km', 'mi', 'inches' ), - ); + 'values' => [ 'degree', 'm', 'ft', 'km', 'mi', 'inches' ], + ]; // zoom information: - $params['minscale'] = array( + $params['minscale'] = [ 'type' => 'float', 'default' => false, 'manipulatedefault' => false, 'message' => 'maps-displaymap-par-coordinates', // TODO-customMaps: create a message - ); + ]; - $params['maxscale'] = array( + $params['maxscale'] = [ 'type' => 'float', 'default' => false, 'manipulatedefault' => false, 'message' => 'maps-displaymap-par-coordinates', // TODO-customMaps: create a message // TODO-customMaps: addManipulations( new MapsParamSwitchIfGreaterThan( $params['minscale'] ) ); - ); + ]; - $params['zoomlevels'] = array( + $params['zoomlevels'] = [ 'type' => 'integer', 'default' => false, 'manipulatedefault' => false, 'message' => 'maps-displaymap-par-coordinates', // TODO-customMaps: create a message // TODO-customMaps: addManipulations( new MapsParamSwitchIfGreaterThan( $params['minscale'] ) ); - ); + ]; return $params; } @@ -276,7 +276,7 @@ protected function getParameterDefinitions() { */ public function getPropertiesHtmlRepresentation( &$parser ) { $this->validate(); // make sure properties are available! - $transformed = array(); + $transformed = []; foreach( $this->properties as $property => $value ) { if( ! $this->isValid() ) { diff --git a/includes/Maps_LayerGroup.php b/includes/Maps_LayerGroup.php index 3f4538bad..2f6ac7697 100644 --- a/includes/Maps_LayerGroup.php +++ b/includes/Maps_LayerGroup.php @@ -25,7 +25,7 @@ class MapsLayerGroup { * * @var array */ - protected $layers = array(); + protected $layers = []; /** * Constructor. @@ -37,9 +37,9 @@ class MapsLayerGroup { * the group since the name is the ID within the group, though, the name is * just optional. */ - public function __construct( $layers = array() ) { + public function __construct( $layers = [] ) { if( ! is_array( $layers ) ) { - $layers = array( $layers ); + $layers = [ $layers ]; } foreach( $layers as $layer ) { // using the function will prevent having layers with the same name: @@ -64,7 +64,7 @@ public function getLayers( $types = self::LAYERS_ALL ) { * by not doing this in the constructor we won't have conflicts with layer * name changes later on. */ - $namedLayers = array(); + $namedLayers = []; foreach( $this->layers as $layer ) { @@ -194,7 +194,7 @@ public function removeLayer ( MapsLayer $layer ) { public static function newFromTitle( Title $title ) { // load all members defined on the page $title: $db = wfGetDB( DB_SLAVE ); - $conditions = array( 'layer_page_id' => $title->getArticleID() ); + $conditions = [ 'layer_page_id' => $title->getArticleID() ]; $layers = self::loadMembersFromConds( $db, $conditions ); if( $layers === false && wfGetLB()->getServerCount() > 1 ) { @@ -215,7 +215,7 @@ public static function newFromTitle( Title $title ) { * @return array|false */ protected static function loadMembersFromConds( $db, $conditions ) { - $results = array(); + $results = []; $res = self::fetchMembersFromConds( $db, $conditions ); if( $res ) { // load all matching layer objects into the layer group: @@ -244,7 +244,7 @@ protected static function loadMembersFromConds( $db, $conditions ) { protected static function fetchMembersFromConds( $db, $conditions ) { $fields = MapsLayers::databaseFields(); $res = $db->select( - array( 'maps_layers' ), + [ 'maps_layers' ], $fields, $conditions, __METHOD__ diff --git a/includes/Maps_LayerPage.php b/includes/Maps_LayerPage.php index b569cefdd..7b96e14aa 100644 --- a/includes/Maps_LayerPage.php +++ b/includes/Maps_LayerPage.php @@ -35,7 +35,7 @@ public function view() { return parent::view(); } - if( !Hooks::run( 'MapsLayerPageView', array( &$this ) ) ) { + if( !Hooks::run( 'MapsLayerPageView', [ &$this ] ) ) { return; } @@ -118,15 +118,15 @@ public function getUsageTitles() { $items = $db->select( 'templatelinks', '*', - array( + [ 'tl_title = "' . $this->mTitle->getDBkey() . '"', 'tl_namespace = ' . $this->mTitle->getNamespace(), - ), + ], __METHOD__ ); // get pages and sort them first: - $titles = array(); + $titles = []; foreach( $items as $item ) { $title = Title::newFromID( $item->tl_from ); @@ -159,7 +159,7 @@ public function hasUsableLayer( $name = null, $service = null ) { if( $layer === null ) { return false; } - $layers = array( $layer ); + $layers = [ $layer ]; } else { $layers = MapsLayers::loadLayerGroup( $this->getTitle() ); $layers = $layers->getLayers(); diff --git a/includes/Maps_LayerTypes.php b/includes/Maps_LayerTypes.php index 725803a56..64b1f4778 100644 --- a/includes/Maps_LayerTypes.php +++ b/includes/Maps_LayerTypes.php @@ -22,7 +22,7 @@ class MapsLayerTypes { * * @var array of string */ - protected static $classes = array(); + protected static $classes = []; /** * List of maps layer types (keys) to the services that they support (values). @@ -31,7 +31,7 @@ class MapsLayerTypes { * * @var array of array of string */ - protected static $services = array(); + protected static $services = []; /** * Returns the type of a layer instance. This is necessary since we do the registering @@ -65,7 +65,7 @@ public static function getAvailableTypes( $service = null ) { return array_keys( self::$classes ); } else { - $layers = array(); + $layers = []; foreach ( self::$services as $layerType => $supportedServices ) { if ( in_array( $service, $supportedServices ) ) { @@ -87,7 +87,7 @@ public static function getAvailableTypes( $service = null ) { * @return array */ public static function getServicesForType( $type ) { - return array_key_exists( $type, self::$services ) ? self::$services[$type] : array(); + return array_key_exists( $type, self::$services ) ? self::$services[$type] : []; } /** @@ -142,7 +142,7 @@ public static function registerLayerType( $type, $layerClass, $serviceIdentifier if( is_array( $serviceIdentifier ) ) { self::$services[$type] = $serviceIdentifier; } else { - self::$services[$type] = array( $serviceIdentifier ); + self::$services[$type] = [ $serviceIdentifier ]; } } diff --git a/includes/Maps_Layers.php b/includes/Maps_Layers.php index e0bcae302..fcffa773d 100644 --- a/includes/Maps_Layers.php +++ b/includes/Maps_Layers.php @@ -20,7 +20,7 @@ class MapsLayers { * * @var MapsLayerGroup */ - protected static $layerGroups = array(); + protected static $layerGroups = []; /** * Returns a new instance of a layer class for the provided layer type to create @@ -84,7 +84,7 @@ public static function newLayerFromRow( $row ) { * @return array */ public static function parseLayerParameters( $parameters, $itemSep = "\n", $keyValueSep = '=' ) { - $keyValuePairs = array(); + $keyValuePairs = []; // get 'key=value' pairs and put them into an array where key is the index for each value foreach ( explode( $itemSep, $parameters ) as $line ) { @@ -171,7 +171,7 @@ public static function storeLayers( MapsLayerGroup $layerGroup, Title $title ) { $db = wfGetDB( DB_MASTER ); // delete old, stored layers first: - $db->delete( 'maps_layers', array( 'layer_page_id' => $pageId ), __METHOD__ ); + $db->delete( 'maps_layers', [ 'layer_page_id' => $pageId ], __METHOD__ ); if( empty( $dbLayers ) ) { // empty group, nothing to insert @@ -189,12 +189,12 @@ public static function storeLayers( MapsLayerGroup $layerGroup, Title $title ) { * @since 3.0 */ public static function databaseFields() { - return array( + return [ 'layer_page_id', 'layer_name', 'layer_type', 'layer_data' - ); + ]; } /** @@ -212,18 +212,18 @@ public static function databaseFields() { public static function databaseRowFromLayer( MapsLayer $layer, $pageId ) { // format layer properties array: - $properties = array(); + $properties = []; foreach( $layer->getProperties() as $key => $prop ) { $properties[] = "$key=$prop"; } $properties = implode( "\n", $properties ); - return array( + return [ 'layer_page_id' => $pageId, 'layer_name' => $layer->getName(), // might be null 'layer_type' => $layer->getType(), 'layer_data' => $properties - ); + ]; } } diff --git a/includes/Maps_Mapper.php b/includes/Maps_Mapper.php index eeea5d35d..ae006c450 100644 --- a/includes/Maps_Mapper.php +++ b/includes/Maps_Mapper.php @@ -74,43 +74,43 @@ public static function encodeJsVar( $value ) { public static function getCommonParameters() { global $egMapsAvailableGeoServices, $egMapsDefaultGeoService, $egMapsMapWidth, $egMapsMapHeight, $egMapsDefaultService; - $params = array(); + $params = []; - $params['mappingservice'] = array( + $params['mappingservice'] = [ 'type' => 'mappingservice', 'aliases' => 'service', 'default' => $egMapsDefaultService, - ); + ]; - $params['geoservice'] = array( + $params['geoservice'] = [ 'default' => $egMapsDefaultGeoService, 'values' => $egMapsAvailableGeoServices, 'dependencies' => 'mappingservice', // TODO 'manipulations' => new MapsParamGeoService( 'mappingservice' ), - ); + ]; - $params['width'] = array( + $params['width'] = [ 'type' => 'dimension', 'allowauto' => true, - 'units' => array( 'px', 'ex', 'em', '%', '' ), + 'units' => [ 'px', 'ex', 'em', '%', '' ], 'default' => $egMapsMapWidth, - ); + ]; - $params['height'] = array( + $params['height'] = [ 'type' => 'dimension', - 'units' => array( 'px', 'ex', 'em', '' ), + 'units' => [ 'px', 'ex', 'em', '' ], 'default' => $egMapsMapHeight, - ); + ]; // TODO$manipulation = new MapsParamLocation(); // TODO$manipulation->toJSONObj = true; - $params['centre'] = array( + $params['centre'] = [ 'type' => 'mapslocation', - 'aliases' => array( 'center' ), + 'aliases' => [ 'center' ], 'default' => false, 'manipulatedefault' => false, - ); + ]; // Give grep a chance to find the usages: // maps-par-mappingservice, maps-par-geoservice, maps-par-width, @@ -155,7 +155,7 @@ public static function getFileUrl( $file ) { */ public static function getBaseMapJSON( $serviceName ) { static $baseInit = false; - static $serviceInit = array(); + static $serviceInit = []; $json = ''; diff --git a/includes/Maps_MappingService.php b/includes/Maps_MappingService.php index 365d6925d..6e38662ad 100644 --- a/includes/Maps_MappingService.php +++ b/includes/Maps_MappingService.php @@ -45,7 +45,7 @@ abstract class MapsMappingService implements iMappingService { * * @var array */ - protected $resourceModules = array(); + protected $resourceModules = []; /** * A list of dependencies (header items) that have been added. @@ -54,7 +54,7 @@ abstract class MapsMappingService implements iMappingService { * * @var array */ - private $addedDependencies = array(); + private $addedDependencies = []; /** * A list of dependencies (header items) that need to be added. @@ -63,7 +63,7 @@ abstract class MapsMappingService implements iMappingService { * * @var array */ - private $dependencies = array(); + private $dependencies = []; /** * Constructor. Creates a new instance of MapsMappingService. @@ -73,7 +73,7 @@ abstract class MapsMappingService implements iMappingService { * @param string $serviceName * @param array $aliases */ - public function __construct( $serviceName, array $aliases = array() ) { + public function __construct( $serviceName, array $aliases = [] ) { $this->serviceName = $serviceName; $this->aliases = $aliases; } @@ -130,7 +130,7 @@ public final function addDependencies( &$parserOrOut ) { * @return array */ public function getConfigVariables() { - return array(); + return []; } /** @@ -140,7 +140,7 @@ public function getConfigVariables() { */ public final function getDependencyHtml() { $allDependencies = array_merge( $this->getDependencies(), $this->dependencies ); - $dependencies = array(); + $dependencies = []; // Only add dependnecies that have not yet been added. foreach ( $allDependencies as $dependency ) { @@ -151,7 +151,7 @@ public final function getDependencyHtml() { } // If there are dependencies, put them all together in a string, otherwise return false. - return $dependencies !== array() ? implode( '', $dependencies ) : false; + return $dependencies !== [] ? implode( '', $dependencies ) : false; } /** @@ -162,7 +162,7 @@ public final function getDependencyHtml() { * @return array */ protected function getDependencies() { - return array(); + return []; } /** diff --git a/includes/Maps_MappingServices.php b/includes/Maps_MappingServices.php index 3d35d65ec..f7bb837cc 100644 --- a/includes/Maps_MappingServices.php +++ b/includes/Maps_MappingServices.php @@ -18,7 +18,7 @@ final class MapsMappingServices { * * @var string[] */ - protected static $registeredServices = array(); + protected static $registeredServices = []; /** * Associative with service identifiers as keys containing instances of @@ -32,7 +32,7 @@ final class MapsMappingServices { * * @var iMappingService[] */ - protected static $services = array(); + protected static $services = []; /** * Registers a service class linked to an identifier. @@ -44,7 +44,7 @@ final class MapsMappingServices { * @param $serviceClassName String * @param $features Array */ - public static function registerService( $serviceIdentifier, $serviceClassName, array $features = array() ) { + public static function registerService( $serviceIdentifier, $serviceClassName, array $features = [] ) { self::$registeredServices[$serviceIdentifier] = $serviceClassName; foreach( $features as $featureName => $featureClassName ) { @@ -207,7 +207,7 @@ protected static function getMainServiceName( $serviceName ) { public static function getAllServiceValues() { global $egMapsAvailableServices; - $allServiceValues = array(); + $allServiceValues = []; foreach ( $egMapsAvailableServices as $availableService ) { $allServiceValues[] = $availableService; @@ -225,7 +225,7 @@ public static function getAllServiceValues() { * @return array of MappingService */ public static function getAllObjects() { - $objects = array(); + $objects = []; foreach ( self::$registeredServices as $service => $class ) { $objects[] = self::getServiceInstance( $service ); diff --git a/includes/api/ApiGeocode.php b/includes/api/ApiGeocode.php index bb43cd663..08874e888 100644 --- a/includes/api/ApiGeocode.php +++ b/includes/api/ApiGeocode.php @@ -24,20 +24,20 @@ public function execute() { global $wgUser; if ( !$wgUser->isAllowed( 'geocode' ) || $wgUser->isBlocked() ) { - $this->dieUsageMsg( array( 'badaccess-groups' ) ); + $this->dieUsageMsg( [ 'badaccess-groups' ] ); } $params = $this->extractRequestParams(); - $results = array(); + $results = []; foreach ( array_unique( $params['locations'] ) as $location ) { $result = \Maps\Geocoders::geocode( $location, $params['service'] ); - $results[$location] = array( + $results[$location] = [ 'count' => $result === false ? 0 : 1, - 'locations' => array() - ); + 'locations' => [] + ]; if ( $result !== false ) { $results[$location]['locations'][] = $result; @@ -54,42 +54,42 @@ public function execute() { } public function getAllowedParams() { - return array( - 'locations' => array( + return [ + 'locations' => [ ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true, ApiBase::PARAM_ISMULTI => true, - ), - 'service' => array( + ], + 'service' => [ ApiBase::PARAM_TYPE => \Maps\Geocoders::getAvailableGeocoders(), - ), - 'props' => array( + ], + 'props' => [ ApiBase::PARAM_ISMULTI => true, - ApiBase::PARAM_TYPE => array( 'lat', 'lon', 'alt' ), + ApiBase::PARAM_TYPE => [ 'lat', 'lon', 'alt' ], ApiBase::PARAM_DFLT => 'lat|lon', - ), - ); + ], + ]; } public function getParamDescription() { - return array( + return [ 'locations' => 'The locations to geocode', 'service' => 'The geocoding service to use', - ); + ]; } public function getDescription() { - return array( + return [ 'API module for geocoding.' - ); + ]; } protected function getExamples() { - return array( + return [ 'api.php?action=geocode&locations=new york', 'api.php?action=geocode&locations=new york|brussels|london', 'api.php?action=geocode&locations=new york&service=geonames', - ); + ]; } } diff --git a/includes/editor/MapEditorHTML.php b/includes/editor/MapEditorHTML.php index 21aa70397..4829b8e64 100644 --- a/includes/editor/MapEditorHTML.php +++ b/includes/editor/MapEditorHTML.php @@ -22,7 +22,7 @@ class MapEditorHtml extends ContextSource{ * @param ContextSource|null $ * @since 2.1 */ - public function __construct( $attribs = array(), ContextSource $contextSource = null ){ + public function __construct( $attribs = [], ContextSource $contextSource = null ){ $this->attribs = $attribs; } diff --git a/includes/geocoders/Maps_GeocoderusGeocoder.php b/includes/geocoders/Maps_GeocoderusGeocoder.php index 825e05e3a..151c033dc 100644 --- a/includes/geocoders/Maps_GeocoderusGeocoder.php +++ b/includes/geocoders/Maps_GeocoderusGeocoder.php @@ -49,9 +49,9 @@ protected function parseResponse( $response ) { // In case one of the values is not found, return false. if ( !$lon || !$lat ) return false; - return array( + return [ 'lat' => (float)$lat, 'lon' => (float)$lon - ); + ]; } } diff --git a/includes/geocoders/Maps_GeonamesGeocoder.php b/includes/geocoders/Maps_GeonamesGeocoder.php index 5fd8b85a5..ce7a70ae0 100644 --- a/includes/geocoders/Maps_GeonamesGeocoder.php +++ b/includes/geocoders/Maps_GeonamesGeocoder.php @@ -58,10 +58,10 @@ protected function parseResponse( $response ) { // In case one of the values is not found, return false. if ( !$lon || !$lat ) return false; - return array( + return [ 'lat' => (float)$lat, 'lon' => (float)$lon - ); + ]; } } \ No newline at end of file diff --git a/includes/geocoders/Maps_GoogleGeocoder.php b/includes/geocoders/Maps_GoogleGeocoder.php index d73347a19..924d9a4a5 100644 --- a/includes/geocoders/Maps_GoogleGeocoder.php +++ b/includes/geocoders/Maps_GoogleGeocoder.php @@ -54,10 +54,10 @@ protected function parseResponse( $response ) { // In case on of the values is not found, return false. if ( !$lon || !$lat ) return false; - return array( + return [ 'lat' => (float)$lat, 'lon' => (float)$lon - ); + ]; } /** @@ -68,7 +68,7 @@ protected function parseResponse( $response ) { * @return array */ public static function getOverrides() { - return array( 'googlemaps3' ); + return [ 'googlemaps3' ]; } } \ No newline at end of file diff --git a/includes/layers/Maps_ImageLayer.php b/includes/layers/Maps_ImageLayer.php index be1f7f0ec..8ecb3d947 100644 --- a/includes/layers/Maps_ImageLayer.php +++ b/includes/layers/Maps_ImageLayer.php @@ -35,32 +35,32 @@ protected function getParameterDefinitions() { $params = parent::getParameterDefinitions(); // map extent for extents bound object: - $params['topextent'] = array( + $params['topextent'] = [ 'type' => 'float', - 'aliases' => array( 'upperbound', 'topbound' ), + 'aliases' => [ 'upperbound', 'topbound' ], 'message' => 'maps-displaymap-par-coordinates', // TODO-customMaps: create a message - ); + ]; - $params['rightextent'] = array( + $params['rightextent'] = [ 'type' => 'float', - 'aliases' => array( 'rightbound' ), + 'aliases' => [ 'rightbound' ], 'message' => 'maps-displaymap-par-coordinates', // TODO-customMaps: create a message - ); + ]; - $params['bottomextent'] = array( + $params['bottomextent'] = [ 'type' => 'float', - 'aliases' => array( 'lowerbound', 'bottombound' ), + 'aliases' => [ 'lowerbound', 'bottombound' ], 'message' => 'maps-displaymap-par-coordinates', // TODO-customMaps: create a message - ); + ]; - $params['leftextent'] = array( + $params['leftextent'] = [ 'type' => 'float', - 'aliases' => array( 'leftbound' ), + 'aliases' => [ 'leftbound' ], 'message' => 'maps-displaymap-par-coordinates', // TODO-customMaps: create a message - ); + ]; // image-source information: - $params['source'] = array( + $params['source'] = [ // TODO-customMaps: addCriteria( new CriterionIsImage() ) 'message' => 'maps-displaymap-par-coordinates', // TODO-customMaps: create a message 'post-format' => function( $source ) { @@ -72,17 +72,17 @@ protected function getParameterDefinitions() { } return $imageUrl; } - ); + ]; - $params['width'] = array( + $params['width'] = [ 'type' => 'float', 'message' => 'maps-displaymap-par-coordinates', // TODO-customMaps: create a message - ); + ]; - $params['height'] = array( + $params['height'] = [ 'type' => 'float', 'message' => 'maps-displaymap-par-coordinates', // TODO-customMaps: create a message - ); + ]; return $params; } @@ -161,10 +161,10 @@ public function getJavaScriptDefinition() { // do image layer options: - $options = array( + $options = [ 'isImage' => true, 'units' => $this->properties['units'], - ); + ]; if( $this->properties['zoomlevels'] !== false ) { $options['numZoomLevels'] = $this->properties['zoomlevels']; diff --git a/includes/parserhooks/Maps_Coordinates.php b/includes/parserhooks/Maps_Coordinates.php index 132f37929..bb4949dbc 100644 --- a/includes/parserhooks/Maps_Coordinates.php +++ b/includes/parserhooks/Maps_Coordinates.php @@ -37,23 +37,23 @@ protected function getParameterInfo( $type ) { global $egMapsCoordinateNotation; global $egMapsCoordinateDirectional; - $params = array(); + $params = []; - $params['location'] = array( + $params['location'] = [ 'type' => 'coordinate', - ); + ]; - $params['format'] = array( + $params['format'] = [ 'default' => $egMapsCoordinateNotation, 'values' => $egMapsAvailableCoordNotations, 'aliases' => 'notation', 'tolower' => true, - ); + ]; - $params['directional'] = array( + $params['directional'] = [ 'type' => 'boolean', 'default' => $egMapsCoordinateDirectional, - ); + ]; // Give grep a chance to find the usages: // maps-coordinates-par-location, maps-coordinates-par-format, maps-coordinates-par-directional @@ -73,7 +73,7 @@ protected function getParameterInfo( $type ) { * @return array */ protected function getDefaultParameters( $type ) { - return array( 'location', 'format', 'directional' ); + return [ 'location', 'format', 'directional' ]; } /** @@ -87,11 +87,11 @@ protected function getDefaultParameters( $type ) { * @return string */ public function render( array $parameters ) { - $options = new \ValueFormatters\FormatterOptions( array( + $options = new \ValueFormatters\FormatterOptions( [ GeoCoordinateFormatter::OPT_FORMAT => $parameters['format'], GeoCoordinateFormatter::OPT_DIRECTIONAL => $parameters['directional'], GeoCoordinateFormatter::OPT_PRECISION => 1 / 360000 - ) ); + ] ); $coordinateFormatter = new GeoCoordinateFormatter( $options ); diff --git a/includes/parserhooks/Maps_DisplayMap.php b/includes/parserhooks/Maps_DisplayMap.php index a053fc67d..c78a98e50 100644 --- a/includes/parserhooks/Maps_DisplayMap.php +++ b/includes/parserhooks/Maps_DisplayMap.php @@ -30,7 +30,7 @@ protected function getName() { * @return array */ protected function getNames() { - return array( $this->getName(), 'display_point', 'display_points', 'display_line' ); + return [ $this->getName(), 'display_point', 'display_points', 'display_line' ]; } /** @@ -46,15 +46,15 @@ protected function getParameterInfo( $type ) { $params['mappingservice']['feature'] = 'display_map'; - $params['coordinates'] = array( + $params['coordinates'] = [ 'type' => 'mapslocation', - 'aliases' => array( 'coords', 'location', 'address', 'addresses', 'locations', 'points' ), - 'dependencies' => array( 'mappingservice', 'geoservice' ), - 'default' => array(), + 'aliases' => [ 'coords', 'location', 'address', 'addresses', 'locations', 'points' ], + 'dependencies' => [ 'mappingservice', 'geoservice' ], + 'default' => [], 'islist' => true, 'delimiter' => $type === ParserHook::TYPE_FUNCTION ? ';' : "\n", 'message' => 'maps-displaymap-par-coordinates', - ); + ]; $params = array_merge( $params, self::getCommonMapParams() ); @@ -70,81 +70,81 @@ protected function getParameterInfo( $type ) { public static function getCommonMapParams() { global $egMapsDefaultTitle, $egMapsDefaultLabel; - $params['title'] = array( + $params['title'] = [ 'name' => 'title', 'default' => $egMapsDefaultTitle, - ); + ]; - $params['label'] = array( + $params['label'] = [ 'default' => $egMapsDefaultLabel, 'aliases' => 'text', - ); + ]; - $params['icon'] = array( + $params['icon'] = [ 'default' => '', // TODO: image param - ); + ]; - $params['visitedicon'] = array( + $params['visitedicon'] = [ 'default' => '', //TODO: image param - ); + ]; - $params['lines'] = array( + $params['lines'] = [ 'type' => 'mapsline', - 'default' => array(), + 'default' => [], 'delimiter' => ';', 'islist' => true, - ); + ]; - $params['polygons'] = array( + $params['polygons'] = [ 'type' => 'mapspolygon', - 'default' => array(), + 'default' => [], 'delimiter' => ';', 'islist' => true, - ); + ]; - $params['circles'] = array( + $params['circles'] = [ 'type' => 'mapscircle', - 'default' => array(), + 'default' => [], 'delimiter' => ';', 'islist' => true, - ); + ]; - $params['rectangles'] = array( + $params['rectangles'] = [ 'type' => 'mapsrectangle', - 'default' => array(), + 'default' => [], 'delimiter' => ';', 'islist' => true, - ); + ]; - $params['wmsoverlay'] = array( + $params['wmsoverlay'] = [ 'type' => 'wmsoverlay', 'default' => false, 'delimiter' => ' ', - ); + ]; - $params['maxzoom'] = array( + $params['maxzoom'] = [ 'type' => 'integer', 'default' => false, 'manipulatedefault' => false, 'dependencies' => 'minzoom', - ); + ]; - $params['minzoom'] = array( + $params['minzoom'] = [ 'type' => 'integer', 'default' => false, 'manipulatedefault' => false, 'lowerbound' => 0, - ); + ]; - $params['copycoords'] = array( + $params['copycoords'] = [ 'type' => 'boolean', 'default' => false, - ); + ]; - $params['static'] = array( + $params['static'] = [ 'type' => 'boolean', 'default' => false, - ); + ]; // Give grep a chance to find the usages: // maps-displaymap-par-title, maps-displaymap-par-label, maps-displaymap-par-icon, @@ -170,7 +170,7 @@ public static function getCommonMapParams() { * @return array */ protected function getDefaultParameters( $type ) { - return array( 'coordinates' ); + return [ 'coordinates' ]; } /** @@ -211,10 +211,10 @@ public function render( array $parameters ) { * @return array */ protected function getFunctionOptions() { - return array( + return [ 'noparse' => true, 'isHTML' => true - ); + ]; } /** diff --git a/includes/parserhooks/Maps_Distance.php b/includes/parserhooks/Maps_Distance.php index 45f2cccbb..5295759b3 100644 --- a/includes/parserhooks/Maps_Distance.php +++ b/includes/parserhooks/Maps_Distance.php @@ -34,21 +34,21 @@ protected function getName() { protected function getParameterInfo( $type ) { global $egMapsDistanceUnit, $egMapsDistanceDecimals; - $params = array(); + $params = []; - $params['distance'] = array( + $params['distance'] = [ 'type' => 'distance', - ); + ]; - $params['unit'] = array( + $params['unit'] = [ 'default' => $egMapsDistanceUnit, 'values' => MapsDistanceParser::getUnits(), - ); + ]; - $params['decimals'] = array( + $params['decimals'] = [ 'type' => 'integer', 'default' => $egMapsDistanceDecimals, - ); + ]; // Give grep a chance to find the usages: // maps-distance-par-distance, maps-distance-par-unit, maps-distance-par-decimals @@ -70,7 +70,7 @@ protected function getParameterInfo( $type ) { * @return array */ protected function getDefaultParameters( $type ) { - return array( 'distance', 'unit', 'decimals' ); + return [ 'distance', 'unit', 'decimals' ]; } /** diff --git a/includes/parserhooks/Maps_Finddestination.php b/includes/parserhooks/Maps_Finddestination.php index 1cde0d341..71378c2e8 100644 --- a/includes/parserhooks/Maps_Finddestination.php +++ b/includes/parserhooks/Maps_Finddestination.php @@ -37,50 +37,50 @@ protected function getParameterInfo( $type ) { global $egMapsAvailableGeoServices, $egMapsDefaultGeoService, $egMapsAvailableCoordNotations; global $egMapsCoordinateNotation, $egMapsAllowCoordsGeocoding, $egMapsCoordinateDirectional; - $params = array(); + $params = []; - $params['location'] = array( - 'dependencies' => array( 'mappingservice', 'geoservice' ), + $params['location'] = [ + 'dependencies' => [ 'mappingservice', 'geoservice' ], 'type' => 'mapslocation', - ); + ]; - $params['format'] = array( + $params['format'] = [ 'default' => $egMapsCoordinateNotation, 'values' => $egMapsAvailableCoordNotations, 'aliases' => 'notation', 'tolower' => true, - ); + ]; - $params['directional'] = array( + $params['directional'] = [ 'type' => 'boolean', 'default' => $egMapsCoordinateDirectional, - ); + ]; - $params['bearing'] = array( + $params['bearing'] = [ 'type' => 'float', - ); + ]; - $params['distance'] = array( + $params['distance'] = [ 'type' => 'distance', - ); + ]; - $params['mappingservice'] = array( + $params['mappingservice'] = [ 'default' => '', 'values' => MapsMappingServices::getAllServiceValues(), 'tolower' => true, - ); + ]; - $params['geoservice'] = array( + $params['geoservice'] = [ 'default' => $egMapsDefaultGeoService, 'aliases' => 'service', 'values' => $egMapsAvailableGeoServices, 'tolower' => true, - ); + ]; - $params['allowcoordinates'] = array( + $params['allowcoordinates'] = [ 'type' => 'boolean', 'default' => $egMapsAllowCoordsGeocoding, - ); + ]; // Give grep a chance to find the usages: // maps-finddestination-par-location, maps-finddestination-par-format, @@ -103,7 +103,7 @@ protected function getParameterInfo( $type ) { * @return array */ protected function getDefaultParameters( $type ) { - return array( 'location', 'bearing', 'distance' ); + return [ 'location', 'bearing', 'distance' ]; } /** @@ -123,11 +123,11 @@ public function render( array $parameters ) { $parameters['distance'] ); - $options = new \ValueFormatters\FormatterOptions( array( + $options = new \ValueFormatters\FormatterOptions( [ GeoCoordinateFormatter::OPT_FORMAT => $parameters['format'], GeoCoordinateFormatter::OPT_DIRECTIONAL => $parameters['directional'], GeoCoordinateFormatter::OPT_PRECISION => 1 / 360000 - ) ); + ] ); $formatter = new GeoCoordinateFormatter( $options ); diff --git a/includes/parserhooks/Maps_Geocode.php b/includes/parserhooks/Maps_Geocode.php index 69df034b7..a392824ae 100644 --- a/includes/parserhooks/Maps_Geocode.php +++ b/includes/parserhooks/Maps_Geocode.php @@ -37,42 +37,42 @@ protected function getParameterInfo( $type ) { global $egMapsDefaultGeoService, $egMapsCoordinateNotation; global $egMapsAllowCoordsGeocoding, $egMapsCoordinateDirectional; - $params = array(); + $params = []; - $params['location'] = array( + $params['location'] = [ 'type' => 'mapslocation', - 'dependencies' => array( 'mappingservice', 'geoservice' ), - ); + 'dependencies' => [ 'mappingservice', 'geoservice' ], + ]; - $params['mappingservice'] = array( + $params['mappingservice'] = [ 'default' => '', 'values' => MapsMappingServices::getAllServiceValues(), 'tolower' => true, - ); + ]; - $params['geoservice'] = array( + $params['geoservice'] = [ 'default' => $egMapsDefaultGeoService, 'aliases' => 'service', 'values' => $egMapsAvailableGeoServices, 'tolower' => true, - ); + ]; - $params['allowcoordinates'] = array( + $params['allowcoordinates'] = [ 'type' => 'boolean', 'default' => $egMapsAllowCoordsGeocoding, - ); + ]; - $params['format'] = array( + $params['format'] = [ 'default' => $egMapsCoordinateNotation, 'values' => $egMapsAvailableCoordNotations, 'aliases' => 'notation', 'tolower' => true, - ); + ]; - $params['directional'] = array( + $params['directional'] = [ 'type' => 'boolean', 'default' => $egMapsCoordinateDirectional, - ); + ]; // Give grep a chance to find the usages: // maps-geocode-par-location, maps-geocode-par-mappingservice, maps-geocode-par-geoservice, @@ -93,7 +93,7 @@ protected function getParameterInfo( $type ) { * @return array */ protected function getDefaultParameters( $type ) { - return array( 'location', 'geoservice', 'mappingservice' ); + return [ 'location', 'geoservice', 'mappingservice' ]; } /** @@ -112,11 +112,11 @@ public function render( array $parameters ) { */ $coordinates = $parameters['location']->getCoordinates(); - $options = new \ValueFormatters\FormatterOptions( array( + $options = new \ValueFormatters\FormatterOptions( [ GeoCoordinateFormatter::OPT_FORMAT => $parameters['format'], GeoCoordinateFormatter::OPT_DIRECTIONAL => $parameters['directional'], GeoCoordinateFormatter::OPT_PRECISION => 1 / 360000 - ) ); + ] ); $formatter = new GeoCoordinateFormatter( $options ); diff --git a/includes/parserhooks/Maps_Geodistance.php b/includes/parserhooks/Maps_Geodistance.php index 34ee88d11..81e493500 100644 --- a/includes/parserhooks/Maps_Geodistance.php +++ b/includes/parserhooks/Maps_Geodistance.php @@ -35,42 +35,42 @@ protected function getName() { protected function getParameterInfo( $type ) { global $egMapsDistanceUnit, $egMapsDistanceDecimals, $egMapsAvailableGeoServices, $egMapsDefaultGeoService; - $params = array(); + $params = []; - $params['mappingservice'] = array( + $params['mappingservice'] = [ 'default' => '', 'values' => MapsMappingServices::getAllServiceValues(), 'tolower' => true, - ); + ]; - $params['geoservice'] = array( + $params['geoservice'] = [ 'default' => $egMapsDefaultGeoService, 'aliases' => 'service', 'values' => $egMapsAvailableGeoServices, 'tolower' => true, - ); + ]; - $params['unit'] = array( + $params['unit'] = [ 'default' => $egMapsDistanceUnit, 'values' => MapsDistanceParser::getUnits(), - ); + ]; - $params['decimals'] = array( + $params['decimals'] = [ 'type' => 'integer', 'default' => $egMapsDistanceDecimals, - ); + ]; - $params['location1'] = array( + $params['location1'] = [ 'type' => 'mapslocation', 'aliases' => 'from', - 'dependencies' => array( 'mappingservice', 'geoservice' ), - ); + 'dependencies' => [ 'mappingservice', 'geoservice' ], + ]; - $params['location2'] = array( + $params['location2'] = [ 'type' => 'mapslocation', 'aliases' => 'to', - 'dependencies' => array( 'mappingservice', 'geoservice' ), - ); + 'dependencies' => [ 'mappingservice', 'geoservice' ], + ]; // Give grep a chance to find the usages: // maps-geodistance-par-mappingservice, maps-geodistance-par-geoservice, @@ -94,7 +94,7 @@ protected function getParameterInfo( $type ) { * @return array */ protected function getDefaultParameters( $type ) { - return array( 'location1', 'location2', 'unit', 'decimals' ); + return [ 'location1', 'location2', 'unit', 'decimals' ]; } /** diff --git a/includes/parserhooks/Maps_LayerDefinition.php b/includes/parserhooks/Maps_LayerDefinition.php index b5d59285b..5d1919739 100644 --- a/includes/parserhooks/Maps_LayerDefinition.php +++ b/includes/parserhooks/Maps_LayerDefinition.php @@ -58,29 +58,29 @@ protected function getName() { * @return array */ protected function getParameterInfo( $type ) { - $params = array(); + $params = []; - $params['type'] = array( + $params['type'] = [ 'default' => false, 'manipulatedefault' => false, 'message' => 'maps-displaymap-par-coordinates', // TODO-customMaps: create a message - ); + ]; - $params['name'] = array( + $params['name'] = [ 'default' => false, 'manipulatedefault' => false, // TODO-customMaps: addCriteria( new CriterionIsNonNumeric ); 'message' => 'maps-displaymap-par-coordinates', // TODO-customMaps: create a message - ); + ]; - $params['definition'] = array( + $params['definition'] = [ 'default' => false, 'manipulatedefault' => false, 'message' => 'maps-displaymap-par-coordinates', // TODO-customMaps: create a message 'post-format' => function( $value ) { return MapsLayers::parseLayerParameters( $value, "\n", '=' ); } - ); + ]; return $params; } @@ -94,7 +94,7 @@ protected function getParameterInfo( $type ) { * @return array */ protected function getDefaultParameters( $type ) { - return array( 'definition' ); + return [ 'definition' ]; } /** @@ -106,10 +106,10 @@ protected function getDefaultParameters( $type ) { * @return array */ protected function getFunctionOptions() { - return array( + return [ 'noparse' => true, 'isHTML' => true - ); + ]; } /** @@ -308,7 +308,7 @@ public function renderLayerInfo( MapsLayer $layer ) { return Html::rawElement( 'div', - array( 'class' => 'mapslayer' . ( $layer->isOk() ? '' : ' mapslayererror' ) ), + [ 'class' => 'mapslayer' . ( $layer->isOk() ? '' : ' mapslayererror' ) ], $outHeader . $outServices . $outTable ); } @@ -347,7 +347,7 @@ protected function getLayerDefinitionTable( MapsLayer $layer ) { $outWarning .= Html::rawElement( 'table', - array( 'width' => '100%', 'class' => ( $layer->isOk() ? 'mapslayerwarntable' : 'mapslayererrortable' ) ), + [ 'width' => '100%', 'class' => ( $layer->isOk() ? 'mapslayerwarntable' : 'mapslayererrortable' ) ], $warnings ); @@ -361,7 +361,7 @@ protected function getLayerDefinitionTable( MapsLayer $layer ) { global $wgOut; $wgOut->addModules( 'ext.maps.layers' ); - $rows = array(); + $rows = []; // rows with layer definition: $properties = $layer->getPropertiesHtmlRepresentation( $this->parser ); @@ -369,15 +369,15 @@ protected function getLayerDefinitionTable( MapsLayer $layer ) { foreach ( $properties as $property => $value ) { $rows[] = Html::rawElement( 'tr', - array(), + [], Html::element( 'td', - array( 'class' => 'mapslayerpropname' ), + [ 'class' => 'mapslayerpropname' ], $property ) . Html::rawElement( 'td', - array( 'class' => 'mapslayerpropval' ), + [ 'class' => 'mapslayerpropval' ], $value ) ); @@ -385,7 +385,7 @@ protected function getLayerDefinitionTable( MapsLayer $layer ) { $out .= Html::rawElement( 'table', - array( 'width' => '100%', 'class' => 'mapslayertable' ), + [ 'width' => '100%', 'class' => 'mapslayertable' ], implode( "\n", $rows ) ); diff --git a/includes/parserhooks/Maps_MapsDoc.php b/includes/parserhooks/Maps_MapsDoc.php index cbde24940..6a3409303 100644 --- a/includes/parserhooks/Maps_MapsDoc.php +++ b/includes/parserhooks/Maps_MapsDoc.php @@ -43,16 +43,16 @@ protected function getName() { * @return array */ protected function getParameterInfo( $type ) { - $params = array(); + $params = []; - $params['service'] = array( + $params['service'] = [ 'values' => $GLOBALS['egMapsAvailableServices'], 'tolower' => true, - ); + ]; - $params['language'] = array( + $params['language'] = [ 'default' => $GLOBALS['wgLanguageCode'], - ); + ]; // Give grep a chance to find the usages: // maps-geocode-par-service, maps-geocode-par-language @@ -72,7 +72,7 @@ protected function getParameterInfo( $type ) { * @return array */ protected function getDefaultParameters( $type ) { - return array( 'service', 'language' ); + return [ 'service', 'language' ]; } /** @@ -119,7 +119,7 @@ protected function msg() { * @return string */ protected function getParameterTable( array $parameters ) { - $tableRows = array(); + $tableRows = []; $parameters = ParamDefinition::getCleanDefinitions( $parameters ); @@ -130,13 +130,13 @@ protected function getParameterTable( array $parameters ) { $table = ''; if ( count( $tableRows ) > 0 ) { - $tableRows = array_merge( array( + $tableRows = array_merge( [ '!' . $this->msg( 'validator-describe-header-parameter' ) ."\n" . //'!' . $this->msg( 'validator-describe-header-aliases' ) ."\n" . '!' . $this->msg( 'validator-describe-header-type' ) ."\n" . '!' . $this->msg( 'validator-describe-header-default' ) ."\n" . '!' . $this->msg( 'validator-describe-header-description' ) - ), $tableRows ); + ], $tableRows ); $table = implode( "\n|-\n", $tableRows ); @@ -184,12 +184,12 @@ protected function getDescriptionRow( ParamDefinition $parameter ) { protected function getServiceParameters( $service ) { $service = MapsMappingServices::getServiceInstance( $service ); - $params = array(); + $params = []; - $params['zoom'] = array( + $params['zoom'] = [ 'type' => 'integer', 'message' => 'maps-par-zoom', - ); + ]; $service->addParameterInfo( $params ); diff --git a/includes/parsers/CircleParser.php b/includes/parsers/CircleParser.php index fd9120b77..3e6bd5a02 100644 --- a/includes/parsers/CircleParser.php +++ b/includes/parsers/CircleParser.php @@ -37,31 +37,31 @@ public function stringParse( $value ) { $circle = new Circle( $this->stringToLatLongValue( $circleData[0] ), (float)$circleData[1] ); - if ( $metaData !== array() ) { + if ( $metaData !== [] ) { $circle->setTitle( array_shift( $metaData ) ); } - if ( $metaData !== array() ) { + if ( $metaData !== [] ) { $circle->setText( array_shift( $metaData ) ); } - if ( $metaData !== array() ) { + if ( $metaData !== [] ) { $circle->setStrokeColor( array_shift( $metaData ) ); } - if ( $metaData !== array() ) { + if ( $metaData !== [] ) { $circle->setStrokeOpacity( array_shift( $metaData ) ); } - if ( $metaData !== array() ) { + if ( $metaData !== [] ) { $circle->setStrokeWeight( array_shift( $metaData ) ); } - if ( $metaData !== array() ) { + if ( $metaData !== [] ) { $circle->setFillColor( array_shift( $metaData ) ); } - if ( $metaData !== array() ) { + if ( $metaData !== [] ) { $circle->setFillOpacity( array_shift( $metaData ) ); } diff --git a/includes/parsers/LineParser.php b/includes/parsers/LineParser.php index f08a00329..d92746a30 100644 --- a/includes/parsers/LineParser.php +++ b/includes/parsers/LineParser.php @@ -52,7 +52,7 @@ public function stringParse( $value ) { * @return LatLongValue[] */ protected function parseCoordinates( array $coordinateStrings ) { - $coordinates = array(); + $coordinates = []; $coordinateParser = new GeoCoordinateParser( new \ValueParsers\ParserOptions() ); $supportsGeocoding = $this->supportGeocoding && \Maps\Geocoders::canGeocode(); diff --git a/includes/parsers/LocationParser.php b/includes/parsers/LocationParser.php index 5c609f015..38148a164 100644 --- a/includes/parsers/LocationParser.php +++ b/includes/parsers/LocationParser.php @@ -42,23 +42,23 @@ public function stringParse( $value ) { $location = new Location( $coordinates ); - if ( $metaData !== array() ) { + if ( $metaData !== [] ) { $this->setTitleOrLink( $location, array_shift( $metaData ) ); } - if ( $metaData !== array() ) { + if ( $metaData !== [] ) { $location->setText( array_shift( $metaData ) ); } - if ( $metaData !== array() ) { + if ( $metaData !== [] ) { $location->setIcon( array_shift( $metaData ) ); } - if ( $metaData !== array() ) { + if ( $metaData !== [] ) { $location->setGroup( array_shift( $metaData ) ); } - if ( $metaData !== array() ) { + if ( $metaData !== [] ) { $location->setInlineLabel( array_shift( $metaData ) ); } diff --git a/includes/parsers/RectangleParser.php b/includes/parsers/RectangleParser.php index 7fdb61373..981d8a21e 100644 --- a/includes/parsers/RectangleParser.php +++ b/includes/parsers/RectangleParser.php @@ -40,23 +40,23 @@ public function stringParse( $value ) { $this->stringToLatLongValue( $rectangleData[1] ) ); - if ( $metaData !== array() ) { + if ( $metaData !== [] ) { $rectangle->setTitle( array_shift( $metaData ) ); } - if ( $metaData !== array() ) { + if ( $metaData !== [] ) { $rectangle->setText( array_shift( $metaData ) ); } - if ( $metaData !== array() ) { + if ( $metaData !== [] ) { $rectangle->setStrokeColor( array_shift( $metaData ) ); } - if ( $metaData !== array() ) { + if ( $metaData !== [] ) { $rectangle->setStrokeOpacity( array_shift( $metaData ) ); } - if ( $metaData !== array() ) { + if ( $metaData !== [] ) { $rectangle->setStrokeWeight( array_shift( $metaData ) ); } diff --git a/includes/services/GoogleMaps3/GoogleMaps3.php b/includes/services/GoogleMaps3/GoogleMaps3.php index 7c61469aa..0d8461f8b 100644 --- a/includes/services/GoogleMaps3/GoogleMaps3.php +++ b/includes/services/GoogleMaps3/GoogleMaps3.php @@ -22,84 +22,84 @@ $pathParts = ( explode( DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR, __DIR__, 2 ) ); - $wgResourceModules['ext.maps.googlemaps3'] = array( - 'dependencies' => array( 'ext.maps.common' ), + $wgResourceModules['ext.maps.googlemaps3'] = [ + 'dependencies' => [ 'ext.maps.common' ], 'localBasePath' => __DIR__, 'remoteExtPath' => end( $pathParts ), 'group' => 'ext.maps', - 'targets' => array( + 'targets' => [ 'mobile', 'desktop' - ), - 'scripts' => array( + ], + 'scripts' => [ 'jquery.googlemap.js', 'ext.maps.googlemaps3.js' - ), - 'messages' => array( + ], + 'messages' => [ 'maps-googlemaps3-incompatbrowser', 'maps-copycoords-prompt', 'maps-searchmarkers-text', 'maps-fullscreen-button', 'maps-fullscreen-button-tooltip', - ) - ); + ] + ]; - $wgResourceModules['ext.maps.gm3.markercluster'] = array( + $wgResourceModules['ext.maps.gm3.markercluster'] = [ 'localBasePath' => __DIR__ . '/gm3-util-library', 'remoteExtPath' => end( $pathParts ), 'group' => 'ext.maps', - 'targets' => array( + 'targets' => [ 'mobile', 'desktop' - ), - 'scripts' => array( + ], + 'scripts' => [ 'markerclusterer.js', - ), - ); + ], + ]; - $wgResourceModules['ext.maps.gm3.markerwithlabel'] = array( + $wgResourceModules['ext.maps.gm3.markerwithlabel'] = [ 'localBasePath' => __DIR__ . '/gm3-util-library', 'remoteExtPath' => end( $pathParts ), 'group' => 'ext.maps', - 'targets' => array( + 'targets' => [ 'mobile', 'desktop' - ), - 'scripts' => array( + ], + 'scripts' => [ 'markerwithlabel.js', - ), - 'styles' => array( + ], + 'styles' => [ 'markerwithlabel.css', - ), - ); + ], + ]; - $wgResourceModules['ext.maps.gm3.geoxml'] = array( + $wgResourceModules['ext.maps.gm3.geoxml'] = [ 'localBasePath' => __DIR__ . '/geoxml3', 'remoteExtPath' => end( $pathParts ), 'group' => 'ext.maps', - 'targets' => array( + 'targets' => [ 'mobile', 'desktop' - ), - 'scripts' => array( + ], + 'scripts' => [ 'geoxml3.js', 'ZipFile.complete.js', //kmz handling 'ProjectedOverlay.js', //Overlay handling - ), - ); + ], + ]; - $wgResourceModules['ext.maps.gm3.earth'] = array( + $wgResourceModules['ext.maps.gm3.earth'] = [ 'localBasePath' => __DIR__ . '/gm3-util-library', 'remoteExtPath' => end( $pathParts ), 'group' => 'ext.maps', - 'targets' => array( + 'targets' => [ 'mobile', 'desktop' - ), - 'scripts' => array( + ], + 'scripts' => [ 'googleearth-compiled.js', - ), - ); + ], + ]; $wgHooks['MappingServiceLoad'][] = 'efMapsInitGoogleMaps3'; } ); diff --git a/includes/services/GoogleMaps3/Maps_GoogleMaps3.php b/includes/services/GoogleMaps3/Maps_GoogleMaps3.php index a2c84008c..12ea5a049 100644 --- a/includes/services/GoogleMaps3/Maps_GoogleMaps3.php +++ b/includes/services/GoogleMaps3/Maps_GoogleMaps3.php @@ -19,7 +19,7 @@ class MapsGoogleMaps3 extends MapsMappingService { * * @var array */ - public static $mapTypes = array( + public static $mapTypes = [ 'normal' => 'ROADMAP', 'roadmap' => 'ROADMAP', 'satellite' => 'SATELLITE', @@ -27,7 +27,7 @@ class MapsGoogleMaps3 extends MapsMappingService { 'terrain' => 'TERRAIN', 'physical' => 'TERRAIN', 'earth' => 'earth' - ); + ]; /** * List of supported map layers. @@ -36,16 +36,16 @@ class MapsGoogleMaps3 extends MapsMappingService { * * @var array */ - protected static $mapLayers = array( + protected static $mapLayers = [ 'traffic', 'bicycling' - ); + ]; - public static $typeControlStyles = array( + public static $typeControlStyles = [ 'default' => 'DEFAULT', 'horizontal' => 'HORIZONTAL_BAR', 'dropdown' => 'DROPDOWN_MENU' - ); + ]; /** * List of supported control names. @@ -54,13 +54,13 @@ class MapsGoogleMaps3 extends MapsMappingService { * * @var array */ - protected static $controlNames = array( + protected static $controlNames = [ 'pan', 'zoom', 'type', 'scale', 'streetview' - ); + ]; /** * Constructor. @@ -70,7 +70,7 @@ class MapsGoogleMaps3 extends MapsMappingService { public function __construct( $serviceName ) { parent::__construct( $serviceName, - array( 'googlemaps', 'google' ) + [ 'googlemaps', 'google' ] ); } @@ -84,23 +84,23 @@ public function addParameterInfo( array &$params ) { global $egMapsGMaps3DefTypeStyle, $egMapsGMaps3DefZoomStyle, $egMapsGMaps3AutoInfoWindows; global $egMapsResizableByDefault, $egMapsGMaps3DefaultTilt; - $params['zoom'] = array( + $params['zoom'] = [ 'type' => 'integer', - 'range' => array( 0, 20 ), + 'range' => [ 0, 20 ], 'default' => self::getDefaultZoom(), 'message' => 'maps-googlemaps3-par-zoom', - ); + ]; - $params['type'] = array( + $params['type'] = [ 'default' => $egMapsGMaps3Type, 'values' => self::getTypeNames(), 'message' => 'maps-googlemaps3-par-type', 'post-format' => function( $value ) { return MapsGoogleMaps3::$mapTypes[strtolower( $value )]; }, - ); + ]; - $params['types'] = array( + $params['types'] = [ 'dependencies' => 'type', 'default' => $egMapsGMaps3Types, 'values' => self::getTypeNames(), @@ -113,16 +113,16 @@ public function addParameterInfo( array &$params ) { return $value; }, - ); + ]; - $params['layers'] = array( + $params['layers'] = [ 'default' => $egMapsGMaps3Layers, 'values' => self::getLayerNames(), 'message' => 'maps-googlemaps3-par-layers', 'islist' => true, - ); + ]; - $params['controls'] = array( + $params['controls'] = [ 'default' => $egMapsGMaps3Controls, 'values' => self::$controlNames, 'message' => 'maps-googlemaps3-par-controls', @@ -130,98 +130,98 @@ public function addParameterInfo( array &$params ) { 'post-format' => function( $value ) { return array_map( 'strtolower', $value ); }, - ); + ]; - $params['zoomstyle'] = array( + $params['zoomstyle'] = [ 'default' => $egMapsGMaps3DefZoomStyle, - 'values' => array( 'default', 'small', 'large' ), + 'values' => [ 'default', 'small', 'large' ], 'message' => 'maps-googlemaps3-par-zoomstyle', 'post-format' => 'strtoupper', - ); + ]; - $params['typestyle'] = array( + $params['typestyle'] = [ 'default' => $egMapsGMaps3DefTypeStyle, 'values' => array_keys( self::$typeControlStyles ), 'message' => 'maps-googlemaps3-par-typestyle', 'post-format' => function( $value ) { return MapsGoogleMaps3::$typeControlStyles[strtolower( $value )]; }, - ); + ]; - $params['autoinfowindows'] = array( + $params['autoinfowindows'] = [ 'type' => 'boolean', 'default' => $egMapsGMaps3AutoInfoWindows, 'message' => 'maps-googlemaps3-par-autoinfowindows', - ); + ]; - $params['resizable'] = array( + $params['resizable'] = [ 'type' => 'boolean', 'default' => $egMapsResizableByDefault, 'message' => 'maps-googlemaps3-par-resizable', - ); + ]; - $params['kmlrezoom'] = array( + $params['kmlrezoom'] = [ 'type' => 'boolean', 'default' => $GLOBALS['egMapsRezoomForKML'], 'message' => 'maps-googlemaps3-par-kmlrezoom', - ); + ]; - $params['poi'] = array( + $params['poi'] = [ 'type' => 'boolean', 'default' => $GLOBALS['egMapsShowPOI'], 'message' => 'maps-googlemaps3-par-poi', - ); + ]; - $params['markercluster'] = array( + $params['markercluster'] = [ 'type' => 'boolean', 'default' => false, 'message' => 'maps-googlemaps3-par-markercluster', - ); + ]; - $params['tilt'] = array( + $params['tilt'] = [ 'type' => 'integer', 'default' => $egMapsGMaps3DefaultTilt, 'message' => 'maps-googlemaps3-par-tilt', - ); + ]; - $params['imageoverlays'] = array( + $params['imageoverlays'] = [ 'type' => 'mapsimageoverlay', - 'default' => array(), + 'default' => [], 'delimiter' => ';', 'islist' => true, 'message' => 'maps-googlemaps3-par-imageoverlays', - ); + ]; - $params['kml'] = array( - 'default' => array(), + $params['kml'] = [ + 'default' => [], 'message' => 'maps-googlemaps3-par-kml', 'islist' => true, // new MapsParamFile() FIXME - ); + ]; - $params['gkml'] = array( - 'default' => array(), + $params['gkml'] = [ + 'default' => [], 'message' => 'maps-googlemaps3-par-gkml', 'islist' => true, - ); + ]; - $params['fusiontables'] = array( - 'default' => array(), + $params['fusiontables'] = [ + 'default' => [], 'message' => 'maps-googlemaps3-par-fusiontables', 'islist' => true, - ); + ]; - $params['searchmarkers'] = array( + $params['searchmarkers'] = [ 'default' => '', 'message' => 'maps-googlemaps3-par-searchmarkers', // new CriterionSearchMarkers() FIXME - ); + ]; - $params['enablefullscreen'] = array( + $params['enablefullscreen'] = [ 'type' => 'boolean', 'default' => false, 'message' => 'maps-googlemaps3-par-enable-fullscreen', - ); + ]; } /** @@ -275,20 +275,20 @@ public static function getLayerNames() { * @return array */ protected function getDependencies() { - return array( + return [ self::getApiScript( is_string( $GLOBALS['egMapsGMaps3Language'] ) ? $GLOBALS['egMapsGMaps3Language'] : $GLOBALS['egMapsGMaps3Language']->getCode() ) - ); + ]; } - public static function getApiScript( $langCode, array $urlArgs = array() ) { + public static function getApiScript( $langCode, array $urlArgs = [] ) { $urlArgs = array_merge( - array( + [ 'language' => self::getMappedLanguageCode( $langCode ), 'sensor' => 'false' - ), + ], $urlArgs ); @@ -303,11 +303,11 @@ public static function getApiScript( $langCode, array $urlArgs = array() ) { * @return string The mapped code */ protected static function getMappedLanguageCode( $code ) { - $mappings = array( + $mappings = [ 'en_gb' => 'en-gb',// v3 supports en_gb - but wants us to call it en-gb 'he' => 'iw', // iw is googlish for hebrew 'fj' => 'fil', // google does not support Fijian - use Filipino as close(?) supported relative - ); + ]; if ( array_key_exists( $code, $mappings ) ) { $code = $mappings[$code]; @@ -326,7 +326,7 @@ protected static function getMappedLanguageCode( $code ) { public function getResourceModules() { return array_merge( parent::getResourceModules(), - array( 'ext.maps.googlemaps3' ) + [ 'ext.maps.googlemaps3' ] ); } } diff --git a/includes/services/Leaflet/Leaflet.php b/includes/services/Leaflet/Leaflet.php index 00b6f7256..ef05f7742 100644 --- a/includes/services/Leaflet/Leaflet.php +++ b/includes/services/Leaflet/Leaflet.php @@ -26,25 +26,25 @@ $pathParts = ( explode( DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR, __DIR__, 2 ) ); - $wgResourceModules['ext.maps.leaflet'] = array( - 'dependencies' => array( 'ext.maps.common' ), + $wgResourceModules['ext.maps.leaflet'] = [ + 'dependencies' => [ 'ext.maps.common' ], 'localBasePath' => __DIR__, 'remoteExtPath' => end( $pathParts ), 'group' => 'ext.maps', - 'targets' => array( + 'targets' => [ 'mobile', 'desktop' - ), - 'scripts' => array( + ], + 'scripts' => [ 'jquery.leaflet.js', 'ext.maps.leaflet.js', - ), - 'messages' => array( + ], + 'messages' => [ 'maps-markers', 'maps-copycoords-prompt', 'maps-searchmarkers-text', - ), - ); + ], + ]; } ); /** diff --git a/includes/services/Leaflet/Maps_Leaflet.php b/includes/services/Leaflet/Maps_Leaflet.php index ad8f246ee..f00439bde 100644 --- a/includes/services/Leaflet/Maps_Leaflet.php +++ b/includes/services/Leaflet/Maps_Leaflet.php @@ -15,7 +15,7 @@ class MapsLeaflet extends MapsMappingService { public function __construct( $serviceName ) { parent::__construct( $serviceName, - array( 'leafletmaps', 'leaflet' ) + [ 'leafletmaps', 'leaflet' ] ); } @@ -25,25 +25,25 @@ public function __construct( $serviceName ) { * @since 3.0 */ public function addParameterInfo( array &$params ) { - $params['zoom'] = array( + $params['zoom'] = [ 'type' => 'integer', - 'range' => array( 0, 20 ), + 'range' => [ 0, 20 ], 'default' => false, 'message' => 'maps-leaflet-par-zoom' - ); + ]; - $params['defzoom'] = array( + $params['defzoom'] = [ 'type' => 'integer', - 'range' => array( 0, 20 ), + 'range' => [ 0, 20 ], 'default' => self::getDefaultZoom(), 'message' => 'maps-leaflet-par-defzoom' - ); + ]; - $params['resizable'] = array( + $params['resizable'] = [ 'type' => 'boolean', 'default' => $GLOBALS['egMapsResizableByDefault'], 'message' => 'maps-leaflet-par-resizable' - ); + ]; } /** @@ -80,17 +80,17 @@ public function getMapId( $increment = true ) { public function getResourceModules() { return array_merge( parent::getResourceModules(), - array( 'ext.maps.leaflet' ) + [ 'ext.maps.leaflet' ] ); } protected function getDependencies() { $leafletPath = $GLOBALS['wgScriptPath'] . '/extensions/Maps/includes/services/Leaflet/leaflet'; - return array( + return [ Html::linkedStyle( "$leafletPath/leaflet.css" ), '', Html::linkedScript( "$leafletPath/leaflet.js" ), - ); + ]; } } diff --git a/includes/services/OpenLayers/Maps_OpenLayers.php b/includes/services/OpenLayers/Maps_OpenLayers.php index 6c3e0a3a5..c41f35bbb 100644 --- a/includes/services/OpenLayers/Maps_OpenLayers.php +++ b/includes/services/OpenLayers/Maps_OpenLayers.php @@ -19,7 +19,7 @@ class MapsOpenLayers extends MapsMappingService { public function __construct( $serviceName ) { parent::__construct( $serviceName, - array( 'layers', 'openlayer' ) + [ 'layers', 'openlayer' ] ); } @@ -31,67 +31,67 @@ public function __construct( $serviceName ) { public function addParameterInfo( array &$params ) { global $egMapsOLLayers, $egMapsOLControls, $egMapsResizableByDefault; - $params['zoom'] = array( + $params['zoom'] = [ 'type' => 'integer', - 'range' => array( 0, 19 ), + 'range' => [ 0, 19 ], 'default' => self::getDefaultZoom(), 'message' => 'maps-openlayers-par-zoom', - ); + ]; - $params['controls'] = array( + $params['controls'] = [ 'default' => $egMapsOLControls, 'values' => self::getControlNames(), 'message' =>'maps-openlayers-par-controls', 'islist' => true, 'tolower' => true, - ); + ]; - $params['layers'] = array( + $params['layers'] = [ 'default' => $egMapsOLLayers, 'message' =>'maps-openlayers-par-layers', 'manipulatedefault' => true, 'islist' => true, 'tolower' => true, // TODO-customMaps: addCriteria( new CriterionOLLayer() ); - ); + ]; - $params['resizable'] = array( + $params['resizable'] = [ 'type' => 'boolean', 'default' => false, 'manipulatedefault' => false, 'message' => 'maps-par-resizable', - ); + ]; - $params['overlays'] = array( + $params['overlays'] = [ // Default empty array will end up in JS just right without manipulation. - 'default' => array(), + 'default' => [], 'manipulatedefault' => false, 'message' => 'maps-openlayers-par-overlays', // NOTE: code has moved into @see MapsDisplayMapRenderer // TODO-customMaps: addCriteria( new CriterionOLLayer( ';' ) ); // TODO-customMaps: addManipulations( new MapsParamOLLayers() ); - ); + ]; - $params['resizable'] = array( + $params['resizable'] = [ 'type' => 'boolean', 'default' => $egMapsResizableByDefault, 'message' => 'maps-par-resizable', - ); + ]; - $params['searchmarkers'] = array( + $params['searchmarkers'] = [ 'default' => '', 'message' => 'maps-openlayers-par-searchmarkers', - 'values' => array( 'title', 'all', '' ), + 'values' => [ 'title', 'all', '' ], 'tolower' => true, - ); + ]; - $params['kml'] = array( - 'default' => array(), + $params['kml'] = [ + 'default' => [], 'message' => 'maps-openlayers-par-kml', 'islist' => true, // new MapsParamFile() FIXME - ); + ]; } /** @@ -127,7 +127,7 @@ public function getMapId( $increment = true ) { * @return array */ public static function getControlNames() { - return array( + return [ 'argparser', 'attribution', 'button', 'dragfeature', 'dragpan', 'drawfeature', 'editingtoolbar', 'getfeature', 'keyboarddefaults', 'layerswitcher', 'measure', 'modifyfeature', 'mousedefaults', 'mouseposition', 'mousetoolbar', @@ -136,7 +136,7 @@ public static function getControlNames() { 'scale', 'scaleline', 'selectfeature', 'snapping', 'split', 'wmsgetfeatureinfo', 'zoombox', 'zoomin', 'zoomout', 'zoompanel', 'zoomtomaxextent' - ); + ]; } /** @@ -181,7 +181,7 @@ public function addLayerDependencies( array $dependencies ) { public function getResourceModules() { return array_merge( parent::getResourceModules(), - array( 'ext.maps.openlayers' ) + [ 'ext.maps.openlayers' ] ); } @@ -195,7 +195,7 @@ public function getResourceModules() { public function getConfigVariables() { return array_merge( parent::getConfigVariables(), - array( 'egMapsScriptPath' => $GLOBALS['wgScriptPath'] . '/extensions/Maps/' ) + [ 'egMapsScriptPath' => $GLOBALS['wgScriptPath'] . '/extensions/Maps/' ] ); } diff --git a/includes/services/OpenLayers/Maps_ParamOLLayers.php b/includes/services/OpenLayers/Maps_ParamOLLayers.php index 08ce54860..c66146e2a 100644 --- a/includes/services/OpenLayers/Maps_ParamOLLayers.php +++ b/includes/services/OpenLayers/Maps_ParamOLLayers.php @@ -44,8 +44,8 @@ public function __construct( $groupNameSeparator = ';' ) { public function manipulate( Parameter &$parameter, array &$parameters ) { global $egMapsOLLayerGroups, $egMapsOLAvailableLayers; - $layerDefs = array(); - $usedLayers = array(); + $layerDefs = []; + $usedLayers = []; foreach ( $parameter->getValue() as $layerOrGroup ) { $lcLayerOrGroup = strtolower( $layerOrGroup ); @@ -153,7 +153,7 @@ public function manipulate( Parameter &$parameter, array &$parameters ) { protected function getDependencies( array $layerNames ) { global $egMapsOLLayerDependencies, $egMapsOLAvailableLayers; - $layerDependencies = array(); + $layerDependencies = []; foreach ( $layerNames as $layerName ) { if ( array_key_exists( $layerName, $egMapsOLAvailableLayers ) // The layer must be defined in php diff --git a/includes/services/OpenLayers/OpenLayers.php b/includes/services/OpenLayers/OpenLayers.php index bf6916c81..633a9270e 100644 --- a/includes/services/OpenLayers/OpenLayers.php +++ b/includes/services/OpenLayers/OpenLayers.php @@ -22,30 +22,30 @@ $pathParts = ( explode( DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR, __DIR__, 2 ) ); - $wgResourceModules['ext.maps.openlayers'] = array( - 'dependencies' => array( 'ext.maps.common' ), + $wgResourceModules['ext.maps.openlayers'] = [ + 'dependencies' => [ 'ext.maps.common' ], 'localBasePath' => __DIR__, 'remoteExtPath' => end( $pathParts ), 'group' => 'ext.maps', - 'targets' => array( + 'targets' => [ 'mobile', 'desktop' - ), - 'scripts' => array( + ], + 'scripts' => [ 'OpenLayers/OpenLayers.js', 'OSM/OpenStreetMap.js', 'jquery.openlayers.js', 'ext.maps.openlayers.js' - ), - 'styles' => array( + ], + 'styles' => [ 'OpenLayers/theme/default/style.css' - ), - 'messages' => array( + ], + 'messages' => [ 'maps-markers', 'maps-copycoords-prompt', 'maps-searchmarkers-text', - ) - ); + ] + ]; $wgAutoloadClasses['MapsOpenLayers'] = __DIR__ . '/Maps_OpenLayers.php'; @@ -56,7 +56,7 @@ function efMapsInitOpenLayers() { MapsMappingServices::registerService( 'openlayers', 'MapsOpenLayers', - array( 'display_map' => 'MapsDisplayMapRenderer' ) + [ 'display_map' => 'MapsDisplayMapRenderer' ] ); return true; diff --git a/includes/specials/SpecialMapEditor.php b/includes/specials/SpecialMapEditor.php index 13b08642d..dc71cfacf 100644 --- a/includes/specials/SpecialMapEditor.php +++ b/includes/specials/SpecialMapEditor.php @@ -34,7 +34,7 @@ public function execute( $subPage ) { $outputPage->addHtml( MapsGoogleMaps3::getApiScript( $this->getLanguage()->getCode(), - array( 'libraries' => 'drawing' ) + [ 'libraries' => 'drawing' ] ) ); $outputPage->addModules( 'mapeditor' ); @@ -49,10 +49,10 @@ public function execute( $subPage ) { * @return array */ protected function getAttribs(){ - return array( + return [ 'id' => 'map-canvas', 'context' => 'SpecialMapEditor' - ); + ]; } protected function getGroupName() { diff --git a/src/Maps/Elements/BaseElement.php b/src/Maps/Elements/BaseElement.php index 5e7935f8f..9a8125922 100644 --- a/src/Maps/Elements/BaseElement.php +++ b/src/Maps/Elements/BaseElement.php @@ -93,7 +93,7 @@ public function setLink( $link ) { * @return array */ public function getJSONObject( $defText = '' , $defTitle = '' ) { - $array = array(); + $array = []; $array['text'] = $this->options->hasOption( 'text' ) ? $this->getText() : $defText; $array['title'] = $this->options->hasOption( 'title' ) ? $this->getTitle() : $defTitle; diff --git a/src/Maps/Elements/Circle.php b/src/Maps/Elements/Circle.php index 7c5383ab6..690422e78 100644 --- a/src/Maps/Elements/Circle.php +++ b/src/Maps/Elements/Circle.php @@ -77,13 +77,13 @@ public function setCircleRadius( $circleRadius ) { public function getJSONObject( $defText = '' , $defTitle = '' ) { $parentArray = parent::getJSONObject( $defText , $defTitle ); - $array = array( - 'centre' => array( + $array = [ + 'centre' => [ 'lon' => $this->getCircleCentre()->getLongitude(), 'lat' => $this->getCircleCentre()->getLatitude() - ) , + ] , 'radius' => intval( $this->getCircleRadius() ), - ); + ]; return array_merge( $parentArray, $array ); } diff --git a/src/Maps/Elements/Line.php b/src/Maps/Elements/Line.php index 26b7ba507..bf07ccff7 100644 --- a/src/Maps/Elements/Line.php +++ b/src/Maps/Elements/Line.php @@ -31,7 +31,7 @@ class Line extends \MapsBaseStrokableElement { * * @throws InvalidArgumentException */ - public function __construct( array $coordinates = array() ) { + public function __construct( array $coordinates = [] ) { foreach ( $coordinates as $coordinate ) { if ( !( $coordinate instanceof LatLongValue ) ) { throw new InvalidArgumentException( 'Can only construct Line with LatLongValue objects' ); @@ -62,16 +62,16 @@ public function getLineCoordinates() { */ public function getJSONObject( $defText = '' , $defTitle = '' ) { $parentArray = parent::getJSONObject( $defText , $defTitle ); - $posArray = array(); + $posArray = []; foreach ( $this->coordinates as $mapLocation ) { - $posArray[] = array( + $posArray[] = [ 'lat' => $mapLocation->getLatitude() , 'lon' => $mapLocation->getLongitude() - ); + ]; } - $posArray = array( 'pos' => $posArray ); + $posArray = [ 'pos' => $posArray ]; return array_merge( $parentArray , $posArray ); } diff --git a/src/Maps/Elements/Location.php b/src/Maps/Elements/Location.php index 1b9012bfd..361741a00 100644 --- a/src/Maps/Elements/Location.php +++ b/src/Maps/Elements/Location.php @@ -305,7 +305,7 @@ public function hasVisitedIcon(){ public function getJSONObject( $defText = '', $defTitle = '', $defIconUrl = '', $defGroup = '', $defInlineLabel = '', $defVisitedIcon = '' ) { $parentArray = parent::getJSONObject( $defText , $defTitle ); - $array = array( + $array = [ 'lat' => $this->coordinates->getLatitude(), 'lon' => $this->coordinates->getLongitude(), 'alt' => 0, @@ -314,7 +314,7 @@ public function getJSONObject( $defText = '', $defTitle = '', $defIconUrl = '', 'group' => $this->hasGroup() ? $this->getGroup() : $defGroup, 'inlineLabel' => $this->hasInlineLabel() ? $this->getInlineLabel() : $defInlineLabel, 'visitedicon' => $this->hasVisitedIcon() ? $this->getVisitedIcon() : $defVisitedIcon, - ); + ]; return array_merge( $parentArray , $array ); } diff --git a/src/Maps/Elements/Rectangle.php b/src/Maps/Elements/Rectangle.php index 9d772756a..d055f7971 100644 --- a/src/Maps/Elements/Rectangle.php +++ b/src/Maps/Elements/Rectangle.php @@ -93,16 +93,16 @@ public function setRectangleNorthEast( LatLongValue $rectangleNorthEast ) { */ public function getJSONObject( $defText = '' , $defTitle = '' ) { $parentArray = parent::getJSONObject( $defText , $defTitle ); - $array = array( - 'ne' => array( + $array = [ + 'ne' => [ 'lon' => $this->getRectangleNorthEast()->getLongitude(), 'lat' => $this->getRectangleNorthEast()->getLatitude() - ), - 'sw' => array( + ], + 'sw' => [ 'lon' => $this->getRectangleSouthWest()->getLongitude(), 'lat' => $this->getRectangleSouthWest()->getLatitude() - ), - ); + ], + ]; return array_merge( $parentArray , $array ); } diff --git a/src/Maps/Elements/WmsOverlay.php b/src/Maps/Elements/WmsOverlay.php index 8ac1ecc8b..c21f9df22 100644 --- a/src/Maps/Elements/WmsOverlay.php +++ b/src/Maps/Elements/WmsOverlay.php @@ -96,11 +96,11 @@ public function getWmsStyleName() { public function getJSONObject ( $defText = "", $defTitle = "" ) { $parentArray = parent::getJSONObject( $defText , $defTitle ); - $array = array ( + $array = [ 'wmsServerUrl' => $this->getWmsServerUrl() , 'wmsLayerName' => $this->getWmsLayerName() , 'wmsStyleName' => $this->getWmsStyleName() - ); + ]; return array_merge( $parentArray, $array ); } diff --git a/tests/phpunit/ElementTest.php b/tests/phpunit/ElementTest.php index f5ba5f816..2dd085369 100644 --- a/tests/phpunit/ElementTest.php +++ b/tests/phpunit/ElementTest.php @@ -19,12 +19,12 @@ class ElementTest extends \PHPUnit_Framework_TestCase { public function elementProvider() { - $elements = array(); + $elements = []; - $elements[] = array( new Rectangle( new LatLongValue( 4, 2 ), new LatLongValue( 5, 6 ) ) ); - $elements[] = array( new ImageOverlay( new LatLongValue( 4, 2 ), new LatLongValue( 5, 6 ), 'foo' ) ); - $elements[] = array( new Circle( new LatLongValue( 4, 2 ), 42 ) ); - $elements[] = array( new Line( array( new LatLongValue( 4, 2 ), new LatLongValue( 5, 6 ) ) ) ); + $elements[] = [ new Rectangle( new LatLongValue( 4, 2 ), new LatLongValue( 5, 6 ) ) ]; + $elements[] = [ new ImageOverlay( new LatLongValue( 4, 2 ), new LatLongValue( 5, 6 ), 'foo' ) ]; + $elements[] = [ new Circle( new LatLongValue( 4, 2 ), 42 ) ]; + $elements[] = [ new Line( [ new LatLongValue( 4, 2 ), new LatLongValue( 5, 6 ) ] ) ]; //$elements[] = new \Maps\Polygon( array( new LatLongValue( 4, 2 ), new LatLongValue( 5, 6 ) ) ); // TODO: location diff --git a/tests/phpunit/MapsDistanceParserTest.php b/tests/phpunit/MapsDistanceParserTest.php index b9c5a94d2..ff1624256 100644 --- a/tests/phpunit/MapsDistanceParserTest.php +++ b/tests/phpunit/MapsDistanceParserTest.php @@ -16,7 +16,7 @@ */ class MapsDistanceParserTest extends \MediaWikiTestCase { - public static $distances = array( + public static $distances = [ '1' => 1, '1m' => 1, '1 m' => 1, @@ -30,33 +30,33 @@ class MapsDistanceParserTest extends \MediaWikiTestCase { '1 mile' => 1609.344, '10 nauticalmiles' => 18520, '1.0nautical mile' => 1852, - ); + ]; - public static $formatTests = array( - 'm' => array( + public static $formatTests = [ + 'm' => [ '1 m' => 1, '1000 m' => 1000.00, '42.42 m' => 42.42, '42.4242 m' => 42.4242, - ), - 'km' => array( + ], + 'km' => [ //'0.001 km' => 1, '1 km' => 1000, '4.24 km' => 4242, - ), - 'kilometers' => array( + ], + 'kilometers' => [ '0.001 kilometers' => 1, '1 kilometers' => 1000, '4.24 kilometers' => 4242, - ), - ); + ], + ]; /** * Invalid distances. * * @var array */ - public static $fakeDistances = array( + public static $fakeDistances = [ 'IN YOUR CODE, BEING TOTALLY RIDICULOUS', '0x20 km', 'km 42', @@ -64,7 +64,7 @@ class MapsDistanceParserTest extends \MediaWikiTestCase { '42 km km', '42 foo', '3.4.2 km' - ); + ]; /** * Tests MapsDistanceParser::parseDistance() @@ -92,9 +92,9 @@ public function testFormatDistance() { * Tests MapsDistanceParser::parseAndFormat() */ public function testParseAndFormat() { - $conversions = array( + $conversions = [ '42 km' => '42000 m' - ); + ]; foreach( array_merge( $conversions, array_reverse( $conversions ) ) as $source => $target ) { global $wgContLang; @@ -138,7 +138,7 @@ public function testGetValidUnit() { global $egMapsDistanceUnit; - foreach ( array( '0', 'swfwdffdhy', 'dxwgdrfh' ) as $unit ) { + foreach ( [ '0', 'swfwdffdhy', 'dxwgdrfh' ] as $unit ) { $u = MapsDistanceParser::getValidUnit( $unit ); $this->assertEquals( $egMapsDistanceUnit, $u, "The valid unit for '$unit' should be '$egMapsDistanceUnit' but was '$u'" ); } diff --git a/tests/phpunit/elements/BaseElementTest.php b/tests/phpunit/elements/BaseElementTest.php index 772b2d557..0e448ebbb 100644 --- a/tests/phpunit/elements/BaseElementTest.php +++ b/tests/phpunit/elements/BaseElementTest.php @@ -26,7 +26,7 @@ public abstract function getClass(); public abstract function validConstructorProvider(); public function invalidConstructorProvider() { - return array(); + return []; } /** @@ -49,11 +49,11 @@ public function newInstance() { * @return array [instance, constructor args] */ public function instanceProvider() { - $phpFails = array( $this, 'newInstance' ); + $phpFails = [ $this, 'newInstance' ]; return array_map( function( array $args ) use ( $phpFails ) { - return array( call_user_func_array( $phpFails, $args ), $args ); + return [ call_user_func_array( $phpFails, $args ), $args ]; }, $this->validConstructorProvider() ); @@ -65,7 +65,7 @@ function( array $args ) use ( $phpFails ) { * @since 3.0 */ public function testGivenValidArguments_constructorDoesNotThrowException() { - $instance = call_user_func_array( array( $this, 'newInstance' ), func_get_args() ); + $instance = call_user_func_array( [ $this, 'newInstance' ], func_get_args() ); $this->assertInstanceOf( $this->getClass(), $instance ); } @@ -76,7 +76,7 @@ public function testGivenValidArguments_constructorDoesNotThrowException() { */ public function testGivenInvalidArguments_constructorThrowsException() { $this->setExpectedException( 'InvalidArgumentException' ); - call_user_func_array( array( $this, 'newInstance' ), func_get_args() ); + call_user_func_array( [ $this, 'newInstance' ], func_get_args() ); } /** diff --git a/tests/phpunit/elements/CircleTest.php b/tests/phpunit/elements/CircleTest.php index 68772a734..b3d70ecee 100644 --- a/tests/phpunit/elements/CircleTest.php +++ b/tests/phpunit/elements/CircleTest.php @@ -27,23 +27,23 @@ public function getClass() { } public function validConstructorProvider() { - $argLists = array(); + $argLists = []; - $argLists[] = array( new LatLongValue( 4, 2 ), 42 ); - $argLists[] = array( new LatLongValue( 42, 2.2 ), 9000.1 ); - $argLists[] = array( new LatLongValue( 4, 2 ), 1 ); - $argLists[] = array( new LatLongValue( 4, 2 ), 0.1 ); + $argLists[] = [ new LatLongValue( 4, 2 ), 42 ]; + $argLists[] = [ new LatLongValue( 42, 2.2 ), 9000.1 ]; + $argLists[] = [ new LatLongValue( 4, 2 ), 1 ]; + $argLists[] = [ new LatLongValue( 4, 2 ), 0.1 ]; return $argLists; } public function invalidConstructorProvider() { - $argLists = array(); + $argLists = []; - $argLists[] = array( new LatLongValue( 4, 2 ), 'foo' ); + $argLists[] = [ new LatLongValue( 4, 2 ), 'foo' ]; - $argLists[] = array( new LatLongValue( 4, 2 ), 0 ); - $argLists[] = array( new LatLongValue( 4, 2 ), -42 ); + $argLists[] = [ new LatLongValue( 4, 2 ), 0 ]; + $argLists[] = [ new LatLongValue( 4, 2 ), -42 ]; return $argLists; } diff --git a/tests/phpunit/elements/LineTest.php b/tests/phpunit/elements/LineTest.php index 908ccdb63..016f41683 100644 --- a/tests/phpunit/elements/LineTest.php +++ b/tests/phpunit/elements/LineTest.php @@ -27,28 +27,28 @@ public function getClass() { } public function validConstructorProvider() { - $argLists = array(); + $argLists = []; - $argLists[] = array( array() ); - $argLists[] = array( array( new LatLongValue( 4, 2 ) ) ); + $argLists[] = [ [] ]; + $argLists[] = [ [ new LatLongValue( 4, 2 ) ] ]; - $argLists[] = array( - array( + $argLists[] = [ + [ new LatLongValue( 4, 2 ), new LatLongValue( 2, 4 ), new LatLongValue( 42, 42 ), - ) - ); + ] + ]; return $argLists; } public function invalidConstructorProvider() { - $argLists = array(); + $argLists = []; - $argLists[] = array( array( '~=[,,_,,]:3' ) ); - $argLists[] = array( array( new LatLongValue( 4, 2 ), '~=[,,_,,]:3' ) ); - $argLists[] = array( array( '~=[,,_,,]:3', new LatLongValue( 4, 2 ) ) ); + $argLists[] = [ [ '~=[,,_,,]:3' ] ]; + $argLists[] = [ [ new LatLongValue( 4, 2 ), '~=[,,_,,]:3' ] ]; + $argLists[] = [ [ '~=[,,_,,]:3', new LatLongValue( 4, 2 ) ] ]; return $argLists; } diff --git a/tests/phpunit/elements/LocationTest.php b/tests/phpunit/elements/LocationTest.php index af8204fee..800861850 100644 --- a/tests/phpunit/elements/LocationTest.php +++ b/tests/phpunit/elements/LocationTest.php @@ -16,12 +16,12 @@ class LocationTest extends \PHPUnit_Framework_TestCase { public function latLongValueProvider() { - $argLists = array(); + $argLists = []; - $argLists[] = array( new LatLongValue( 0, 0 ) ); - $argLists[] = array( new LatLongValue( 4, 2 ) ); - $argLists[] = array( new LatLongValue( 42, 42 ) ); - $argLists[] = array( new LatLongValue( -4.2, -42 ) ); + $argLists[] = [ new LatLongValue( 0, 0 ) ]; + $argLists[] = [ new LatLongValue( 4, 2 ) ]; + $argLists[] = [ new LatLongValue( 42, 42 ) ]; + $argLists[] = [ new LatLongValue( -4.2, -42 ) ]; return $argLists; } diff --git a/tests/phpunit/elements/RectangleTest.php b/tests/phpunit/elements/RectangleTest.php index 15bfc880b..762b21575 100644 --- a/tests/phpunit/elements/RectangleTest.php +++ b/tests/phpunit/elements/RectangleTest.php @@ -27,18 +27,18 @@ public function getClass() { } public function validConstructorProvider() { - $argLists = array(); + $argLists = []; - $argLists[] = array( new LatLongValue( 4, 2 ), new LatLongValue( -4, -2 ) ); - $argLists[] = array( new LatLongValue( -42, -42 ), new LatLongValue( -4, -2 ) ); + $argLists[] = [ new LatLongValue( 4, 2 ), new LatLongValue( -4, -2 ) ]; + $argLists[] = [ new LatLongValue( -42, -42 ), new LatLongValue( -4, -2 ) ]; return $argLists; } public function invalidConstructorProvider() { - $argLists = array(); + $argLists = []; - $argLists[] = array( new LatLongValue( 4, 2 ), new LatLongValue( 4, 2 ) ); + $argLists[] = [ new LatLongValue( 4, 2 ), new LatLongValue( 4, 2 ) ]; return $argLists; } @@ -59,10 +59,10 @@ public function testGetCorners( Rectangle $rectangle, array $arguments ) { * @param array $arguments */ public function testSetCorners( Rectangle $rectangle, array $arguments ) { - $coordinates = array( + $coordinates = [ new LatLongValue( 42, 42 ), new LatLongValue( 0, 0 ) - ); + ]; foreach ( $coordinates as $coordinate ) { $rectangle->setRectangleNorthEast( $coordinate ); diff --git a/tests/phpunit/parserhooks/CoordinatesTest.php b/tests/phpunit/parserhooks/CoordinatesTest.php index b07541164..e59912f52 100644 --- a/tests/phpunit/parserhooks/CoordinatesTest.php +++ b/tests/phpunit/parserhooks/CoordinatesTest.php @@ -32,51 +32,51 @@ protected function getInstance() { * @return array */ public function parametersProvider() { - $paramLists = array(); + $paramLists = []; - $paramLists[] = array( - array( + $paramLists[] = [ + [ 'location' => '4,2', 'format' => 'dms', 'directional' => 'no', - ), + ], '4° 0\' 0.00", 2° 0\' 0.00"' - ); + ]; - $paramLists[] = array( - array( + $paramLists[] = [ + [ 'location' => '55 S, 37.6176330 W', 'format' => 'dms', 'directional' => 'no', - ), + ], '-55° 0\' 0.00", -37° 37\' 3.48"' - ); + ]; - $paramLists[] = array( - array( + $paramLists[] = [ + [ 'location' => '4,2', 'format' => 'float', 'directional' => 'no', - ), + ], '4, 2' - ); + ]; - $paramLists[] = array( - array( + $paramLists[] = [ + [ 'location' => '-4,-2', 'format' => 'float', 'directional' => 'yes', - ), + ], '4 S, 2 W' - ); + ]; - $paramLists[] = array( - array( + $paramLists[] = [ + [ 'location' => '55 S, 37.6176330 W', 'directional' => 'yes', - ), + ], '55° 0\' 0.00" S, 37° 37\' 3.48" W' - ); + ]; return $paramLists; } @@ -88,45 +88,45 @@ public function parametersProvider() { */ public function processingProvider() { $definitions = ParamDefinition::getCleanDefinitions( $this->getInstance()->getParamDefinitions() ); - $argLists = array(); + $argLists = []; - $values = array( + $values = [ 'location' => '4,2', - ); + ]; - $expected = array( + $expected = [ 'location' => new LatLongValue( 4, 2 ), - ); + ]; - $argLists[] = array( $values, $expected ); + $argLists[] = [ $values, $expected ]; - $values = array( + $values = [ 'location' => '4,2', 'directional' => $definitions['directional']->getDefault() ? 'no' : 'yes', 'format' => 'dd', - ); + ]; - $expected = array( + $expected = [ 'location' => new LatLongValue( 4, 2 ), 'directional' => !$definitions['directional']->getDefault(), 'format' => Maps_COORDS_DD, - ); + ]; - $argLists[] = array( $values, $expected ); + $argLists[] = [ $values, $expected ]; - $values = array( + $values = [ 'location' => '4,2', 'directional' => $definitions['directional']->getDefault() ? 'NO' : 'YES', 'format' => ' DD ', - ); + ]; - $expected = array( + $expected = [ 'location' => new LatLongValue( 4, 2 ), 'directional' => !$definitions['directional']->getDefault(), 'format' => Maps_COORDS_DD, - ); + ]; - $argLists[] = array( $values, $expected ); + $argLists[] = [ $values, $expected ]; return $argLists; } diff --git a/tests/phpunit/parserhooks/DisplayMapTest.php b/tests/phpunit/parserhooks/DisplayMapTest.php index c74d067a6..7a40d2bb6 100644 --- a/tests/phpunit/parserhooks/DisplayMapTest.php +++ b/tests/phpunit/parserhooks/DisplayMapTest.php @@ -31,23 +31,23 @@ protected function getInstance() { * @return array */ public function parametersProvider() { - $paramLists = array(); + $paramLists = []; // TODO - $paramLists[] = array( 'coordinates' => '4,2' ); + $paramLists[] = [ 'coordinates' => '4,2' ]; - $paramLists[] = array( 'location' => '4,2' ); + $paramLists[] = [ 'location' => '4,2' ]; - $paramLists[] = array( 'location' => 'new york city' ); + $paramLists[] = [ 'location' => 'new york city' ]; - $paramLists[] = array( + $paramLists[] = [ 'service' => 'googlemaps', 'location' => 'new york city', 'zoom' => '10', 'minzoom' => '5', 'maxzoom' => '7', 'autozoom' => 'off', - ); + ]; return $this->arrayWrap( $paramLists ); } @@ -62,23 +62,23 @@ public function testForSomeReasonPhpSegfaultsIfThereIsOneMethodLess() { * @return array */ public function processingProvider() { - $argLists = array(); + $argLists = []; - $values = array( + $values = [ 'locations' => '4,2', 'width' => '420', 'height' => '420', 'service' => 'openlayers', - ); + ]; - $expected = array( - 'coordinates' => array( new Location( new \DataValues\LatLongValue( 4, 2 ) ) ), + $expected = [ + 'coordinates' => [ new Location( new \DataValues\LatLongValue( 4, 2 ) ) ], 'width' => '420px', 'height' => '420px', 'mappingservice' => 'openlayers', - ); + ]; - $argLists[] = array( $values, $expected ); + $argLists[] = [ $values, $expected ]; return $argLists; } diff --git a/tests/phpunit/parserhooks/DistanceTest.php b/tests/phpunit/parserhooks/DistanceTest.php index 3f25b02ea..50c00a6de 100644 --- a/tests/phpunit/parserhooks/DistanceTest.php +++ b/tests/phpunit/parserhooks/DistanceTest.php @@ -27,14 +27,14 @@ protected function getInstance() { * @since 3.0 * @var array */ - protected $distances = array( + protected $distances = [ '42' => 42, '42m' => 42, '42 m' => 42, '42 km' => 42000, '4.2 km' => 4200, '4.2 m' => 4.2, - ); + ]; /** * @see ParserHookTest::parametersProvider @@ -42,10 +42,10 @@ protected function getInstance() { * @return array */ public function parametersProvider() { - $paramLists = array(); + $paramLists = []; foreach ( array_keys( $this->distances ) as $distance ) { - $paramLists[] = array( 'distance' => (string)$distance ); + $paramLists[] = [ 'distance' => (string)$distance ]; } return $this->arrayWrap( $paramLists ); @@ -57,45 +57,45 @@ public function parametersProvider() { * @return array */ public function processingProvider() { - $argLists = array(); + $argLists = []; foreach ( $this->distances as $input => $output ) { - $values = array( + $values = [ 'distance' => (string)$input, - ); + ]; - $expected = array( + $expected = [ 'distance' => $output, - ); + ]; - $argLists[] = array( $values, $expected ); + $argLists[] = [ $values, $expected ]; } - $values = array( + $values = [ 'distance' => '42m', 'unit' => 'km', 'decimals' => '1', - ); + ]; - $expected = array( + $expected = [ 'distance' => 42, 'unit' => 'km', 'decimals' => 1, - ); + ]; - $argLists[] = array( $values, $expected ); + $argLists[] = [ $values, $expected ]; - $values = array( + $values = [ 'distance' => '42m', 'unit' => '~=[,,_,,]:3', 'decimals' => 'foobar', - ); + ]; - $expected = array( + $expected = [ 'distance' => 42, - ); + ]; - $argLists[] = array( $values, $expected ); + $argLists[] = [ $values, $expected ]; return $argLists; } diff --git a/tests/phpunit/parserhooks/FinddestinationTest.php b/tests/phpunit/parserhooks/FinddestinationTest.php index 67009e180..6b79533d4 100644 --- a/tests/phpunit/parserhooks/FinddestinationTest.php +++ b/tests/phpunit/parserhooks/FinddestinationTest.php @@ -21,34 +21,34 @@ class FinddestinationTest extends ParserHookTest { * @since 3.0 * @var string[] */ - protected $locations = array( + protected $locations = [ '4,2', '4.2,-42', - ); + ]; /** * @since 3.0 * @var array */ - protected $bearings = array( + protected $bearings = [ 1, 42, -42, 0, 4.2, - ); + ]; /** * @since 3.0 * @var string[] */ - protected $distances = array( + protected $distances = [ '42' => 42, '0' => 0, '42 m' => 42, '42 km' => 42000, '4.2 km' => 4200, - ); + ]; /** * @see ParserHookTest::getInstance @@ -65,13 +65,13 @@ protected function getInstance() { * @return array */ public function parametersProvider() { - $paramLists = array(); + $paramLists = []; - $paramLists[] = array( + $paramLists[] = [ 'location' => '4,2', 'bearing' => '1', 'distance' => '42 km' - ); + ]; return $this->arrayWrap( $paramLists ); } @@ -82,26 +82,26 @@ public function parametersProvider() { * @return array */ public function processingProvider() { - $argLists = array(); + $argLists = []; $coordinateParser = new GeoCoordinateParser( new \ValueParsers\ParserOptions() ); foreach ( $this->distances as $distance => $expectedDistance ) { foreach ( $this->bearings as $bearing ) { foreach ( $this->locations as $location ) { - $values = array( + $values = [ 'distance' => (string)$distance, 'bearing' => (string)$bearing, 'location' => (string)$location, - ); + ]; - $expected = array( + $expected = [ 'distance' => $expectedDistance, 'bearing' => (float)$bearing, 'location' => new Location( $coordinateParser->parse( $location )->getValue() ), - ); + ]; - $argLists[] = array( $values, $expected ); + $argLists[] = [ $values, $expected ]; } } } diff --git a/tests/phpunit/parserhooks/GeocodeTest.php b/tests/phpunit/parserhooks/GeocodeTest.php index c3bb0878f..66c391a3f 100644 --- a/tests/phpunit/parserhooks/GeocodeTest.php +++ b/tests/phpunit/parserhooks/GeocodeTest.php @@ -30,9 +30,9 @@ protected function getInstance() { * @return array */ public function parametersProvider() { - $paramLists = array(); + $paramLists = []; - $paramLists[] = array( 'location' => 'new york city' ); + $paramLists[] = [ 'location' => 'new york city' ]; return $this->arrayWrap( $paramLists ); } @@ -43,19 +43,19 @@ public function parametersProvider() { * @return array */ public function processingProvider() { - $argLists = array(); + $argLists = []; - $values = array( + $values = [ 'location' => '4,2', 'allowcoordinates' => 'yes', - ); + ]; - $expected = array( + $expected = [ 'location' => new Location( new \DataValues\LatLongValue( 4, 2 ) ), 'allowcoordinates' => true, - ); + ]; - $argLists[] = array( $values, $expected ); + $argLists[] = [ $values, $expected ]; return $argLists; } diff --git a/tests/phpunit/parserhooks/GeodistanceTest.php b/tests/phpunit/parserhooks/GeodistanceTest.php index 3d7e21a79..26ec79c0f 100644 --- a/tests/phpunit/parserhooks/GeodistanceTest.php +++ b/tests/phpunit/parserhooks/GeodistanceTest.php @@ -32,17 +32,17 @@ protected function getInstance() { * @return array */ public function parametersProvider() { - $paramLists = array(); + $paramLists = []; - $paramLists[] = array( + $paramLists[] = [ 'location1' => '4,2', 'location2' => '42,0', - ); + ]; - $paramLists[] = array( + $paramLists[] = [ '4,2', '42,0', - ); + ]; return $this->arrayWrap( $paramLists ); } @@ -53,34 +53,34 @@ public function parametersProvider() { * @return array */ public function processingProvider() { - $argLists = array(); + $argLists = []; - $values = array( + $values = [ 'location1' => '4,2', 'location2' => '42,0', - ); + ]; - $expected = array( + $expected = [ 'location1' => new Location( new LatLongValue( 4, 2 ) ), 'location2' => new Location( new LatLongValue( 42, 0 ) ), - ); + ]; - $argLists[] = array( $values, $expected ); + $argLists[] = [ $values, $expected ]; - $values = array( + $values = [ 'location1' => '4,2', 'location2' => '42,0', 'unit' => '~=[,,_,,]:3', 'decimals' => '1', - ); + ]; - $expected = array( + $expected = [ 'location1' => new Location( new LatLongValue( 4, 2 ) ), 'location2' => new Location( new LatLongValue( 42, 0 ) ), 'decimals' => 1, - ); + ]; - $argLists[] = array( $values, $expected ); + $argLists[] = [ $values, $expected ]; return $argLists; } diff --git a/tests/phpunit/parserhooks/MapsDocTest.php b/tests/phpunit/parserhooks/MapsDocTest.php index 77151bacf..479ef5869 100644 --- a/tests/phpunit/parserhooks/MapsDocTest.php +++ b/tests/phpunit/parserhooks/MapsDocTest.php @@ -28,9 +28,9 @@ protected function getInstance() { * @return array */ public function parametersProvider() { - $paramLists = array(); + $paramLists = []; - $paramLists[] = array(); + $paramLists[] = []; return $this->arrayWrap( $paramLists ); } @@ -41,20 +41,20 @@ public function parametersProvider() { * @return array */ public function processingProvider() { - $argLists = array(); + $argLists = []; - $values = array( 'service' => 'googlemaps3' ); + $values = [ 'service' => 'googlemaps3' ]; - $expected = array( 'service' => 'googlemaps3' ); + $expected = [ 'service' => 'googlemaps3' ]; - $argLists[] = array( $values, $expected ); + $argLists[] = [ $values, $expected ]; - $values = array( 'service' => 'GOOGLEmaps3' ); + $values = [ 'service' => 'GOOGLEmaps3' ]; - $expected = array( 'service' => 'googlemaps3' ); + $expected = [ 'service' => 'googlemaps3' ]; - $argLists[] = array( $values, $expected ); + $argLists[] = [ $values, $expected ]; return $argLists; } diff --git a/tests/phpunit/parserhooks/ParserHookTest.php b/tests/phpunit/parserhooks/ParserHookTest.php index f8a274182..ac6e7fbee 100644 --- a/tests/phpunit/parserhooks/ParserHookTest.php +++ b/tests/phpunit/parserhooks/ParserHookTest.php @@ -44,8 +44,8 @@ public function testRender( array $parameters, $expected = null ) { $parser->setTitle( \Title::newMainPage() ); $renderResult = call_user_func_array( - array( $parserHook, 'renderFunction' ), - array_merge( array( &$parser ), $parameters ) + [ $parserHook, 'renderFunction' ], + array_merge( [ &$parser ], $parameters ) ); if ( is_string( $renderResult ) ) { @@ -62,7 +62,7 @@ public function testRender( array $parameters, $expected = null ) { } public function processingProvider() { - return array(); + return []; } /** @@ -108,7 +108,7 @@ public function testParamProcessing( array $parameters, array $expectedValues ) protected function getDefaultValues() { $definitions = ParamDefinition::getCleanDefinitions( $this->getInstance()->getParamDefinitions() ); - $defaults = array(); + $defaults = []; foreach ( $definitions as $definition ) { if ( !$definition->isRequired() ) { @@ -122,7 +122,7 @@ protected function getDefaultValues() { protected function arrayWrap( array $elements ) { return array_map( function ( $element ) { - return array( $element ); + return [ $element ]; }, $elements ); diff --git a/tests/phpunit/parsers/LineParserTest.php b/tests/phpunit/parsers/LineParserTest.php index 201e38195..b69032da2 100644 --- a/tests/phpunit/parsers/LineParserTest.php +++ b/tests/phpunit/parsers/LineParserTest.php @@ -22,39 +22,39 @@ class LineParserTest extends \ValueParsers\Test\StringValueParserTest { * @return array */ public function validInputProvider() { - $argLists = array(); + $argLists = []; - $valid = array(); + $valid = []; - $valid[] = array( - array( + $valid[] = [ + [ 42, 4.2 - ), - ); + ], + ]; - $valid[] = array( - array( + $valid[] = [ + [ 49.83798245308486, 2.724609375 - ), - array( + ], + [ 52.05249047600102, 8.26171875 - ), - array( + ], + [ 46.37725420510031, 6.15234375 - ), - array( + ], + [ 49.83798245308486, 2.724609375 - ), - ); + ], + ]; foreach ( $valid as $values ) { - $input = array(); - $output = array(); + $input = []; + $output = []; foreach ( $values as $value ) { $input[] = implode( ',', $value ); @@ -63,7 +63,7 @@ public function validInputProvider() { $input = implode( ':', $input ); - $argLists[] = array( $input, new Line( $output ) ); + $argLists[] = [ $input, new Line( $output ) ]; } return $argLists; diff --git a/tests/phpunit/parsers/LocationParserTest.php b/tests/phpunit/parsers/LocationParserTest.php index ac440b026..987952e6e 100644 --- a/tests/phpunit/parsers/LocationParserTest.php +++ b/tests/phpunit/parsers/LocationParserTest.php @@ -23,27 +23,27 @@ class LocationParserTest extends \ValueParsers\Test\StringValueParserTest { * @return array */ public function validInputProvider() { - $argLists = array(); - - $valid = array( - '55.7557860 N, 37.6176330 W' => array( 55.7557860, -37.6176330 ), - '55.7557860, -37.6176330' => array( 55.7557860, -37.6176330 ), - '55 S, 37.6176330 W' => array( -55, -37.6176330 ), - '-55, -37.6176330' => array( -55, -37.6176330 ), - '5.5S,37W ' => array( -5.5, -37 ), - '-5.5,-37 ' => array( -5.5, -37 ), - '4,2' => array( 4, 2 ), - ); + $argLists = []; + + $valid = [ + '55.7557860 N, 37.6176330 W' => [ 55.7557860, -37.6176330 ], + '55.7557860, -37.6176330' => [ 55.7557860, -37.6176330 ], + '55 S, 37.6176330 W' => [ -55, -37.6176330 ], + '-55, -37.6176330' => [ -55, -37.6176330 ], + '5.5S,37W ' => [ -5.5, -37 ], + '-5.5,-37 ' => [ -5.5, -37 ], + '4,2' => [ 4, 2 ], + ]; foreach ( $valid as $value => $expected ) { $expected = new Location( new LatLongValue( $expected[0], $expected[1] ) ); - $argLists[] = array( (string)$value, $expected ); + $argLists[] = [ (string)$value, $expected ]; } $location = new Location( new LatLongValue( 4, 2 ) ); $location->setTitle( 'Title' ); $location->setText( 'some description' ); - $argLists[] = array( '4,2~Title~some description', $location ); + $argLists[] = [ '4,2~Title~some description', $location ]; return $argLists; } @@ -70,13 +70,13 @@ public function testGivenTitleThatIsNotLink_titleIsSetAndLinkIsNot( $title ) { } public function titleProvider() { - return array( - array( '' ), - array( 'Title' ), - array( 'Some title' ), - array( 'link' ), - array( 'links:foo' ), - ); + return [ + [ '' ], + [ 'Title' ], + [ 'Some title' ], + [ 'link' ], + [ 'links:foo' ], + ]; } protected function assertTitleAndLinkAre( Location $location, $title, $link ) { @@ -105,11 +105,11 @@ public function testGivenTitleThatIsLink_linkIsSetAndTitleIsNot( $link ) { } public function linkProvider() { - return array( - array( 'https://semantic-mediawiki.org' ), - array( 'http://www.semantic-mediawiki.org' ), - array( 'irc://freenode.net' ), - ); + return [ + [ 'https://semantic-mediawiki.org' ], + [ 'http://www.semantic-mediawiki.org' ], + [ 'irc://freenode.net' ], + ]; } /** diff --git a/tests/phpunit/parsers/WmsOverlayParserTest.php b/tests/phpunit/parsers/WmsOverlayParserTest.php index 406f55542..24bcee0e7 100644 --- a/tests/phpunit/parsers/WmsOverlayParserTest.php +++ b/tests/phpunit/parsers/WmsOverlayParserTest.php @@ -18,14 +18,14 @@ class WmsOverlayParserTest extends \ValueParsers\Test\StringValueParserTest { * @return array */ public function validInputProvider() { - $argLists = array(); + $argLists = []; - $valid = array( + $valid = [ "http://demo.cubewerx.com/demo/cubeserv/cubeserv.cgi? Foundation.GTOPO30" => - array( "http://demo.cubewerx.com/demo/cubeserv/cubeserv.cgi?", "Foundation.GTOPO30" ), + [ "http://demo.cubewerx.com/demo/cubeserv/cubeserv.cgi?", "Foundation.GTOPO30" ], "http://maps.imr.no:80/geoserver/wms? vulnerable_areas:Identified_coral_area coral_identified_areas" => - array( "http://maps.imr.no:80/geoserver/wms?", "vulnerable_areas:Identified_coral_area", "coral_identified_areas" ) - ); + [ "http://maps.imr.no:80/geoserver/wms?", "vulnerable_areas:Identified_coral_area", "coral_identified_areas" ] + ]; foreach ( $valid as $value => $expected ) { $expectedOverlay = new WmsOverlay( $expected[0], $expected[1] ); @@ -34,7 +34,7 @@ public function validInputProvider() { $expectedOverlay->setWmsStyleName( $expected[2] ); } - $argLists[] = array( (string)$value, $expectedOverlay ); + $argLists[] = [ (string)$value, $expectedOverlay ]; } return $argLists;