Skip to content

Commit

Permalink
Apply php-c-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
pdrillin committed Jan 21, 2021
1 parent 0371547 commit bd11bea
Show file tree
Hide file tree
Showing 13 changed files with 328 additions and 332 deletions.
1 change: 1 addition & 0 deletions .php_cs.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"php":"7.4.3","version":"2.16.4","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":{"allow_single_line_closure":true},"class_definition":{"single_line":true},"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":true,"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"long"},"binary_operator_spaces":true,"blank_line_after_opening_tag":true,"blank_line_before_statement":true,"cast_spaces":true,"class_attributes_separation":{"elements":["method"]},"concat_space":true,"declare_equal_normalize":true,"function_typehint_space":true,"include":true,"increment_style":true,"lowercase_cast":true,"lowercase_static_reference":true,"magic_constant_casing":true,"magic_method_casing":true,"native_function_casing":true,"native_function_type_declaration_casing":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_blank_lines":true,"no_leading_import_slash":true,"no_leading_namespace_whitespace":true,"no_mixed_echo_print":true,"no_multiline_whitespace_around_double_arrow":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_superfluous_phpdoc_tags":{"allow_mixed":true,"allow_unused_params":true},"no_trailing_comma_in_list_call":true,"no_trailing_comma_in_singleline_array":true,"no_unneeded_control_parentheses":true,"no_unneeded_curly_braces":{"namespaces":true},"no_unused_imports":true,"no_whitespace_before_comma_in_array":true,"no_whitespace_in_blank_line":true,"normalize_index_brace":true,"object_operator_without_whitespace":true,"ordered_imports":true,"php_unit_fqcn_annotation":true,"phpdoc_align":{"tags":["method","param","property","return","throws","type","var"]},"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":true,"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_return_self_reference":true,"phpdoc_scalar":true,"phpdoc_separation":true,"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_to_comment":true,"phpdoc_trim":true,"phpdoc_trim_consecutive_blank_line_separation":true,"phpdoc_types":true,"phpdoc_types_order":true,"phpdoc_var_without_name":true,"return_type_declaration":true,"semicolon_after_instruction":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_line_comment_style":true,"single_quote":true,"single_trait_insert_per_statement":true,"space_after_semicolon":{"remove_in_empty_for_expressions":true},"standardize_increment":true,"standardize_not_equals":true,"ternary_operator_spaces":true,"trailing_comma_in_multiline_array":true,"trim_array_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true,"yoda_style":{"always_move_variable":false,"equal":false,"identical":false,"less_and_greater":null},"align_multiline_comment":true,"array_indentation":true,"combine_consecutive_issets":true,"combine_consecutive_unsets":true,"compact_nullable_typehint":true,"escape_implicit_backslashes":true,"explicit_indirect_variable":true,"explicit_string_variable":true,"fully_qualified_strict_types":true,"heredoc_to_nowdoc":true,"method_chaining_indentation":true,"multiline_comment_opening_closing":true,"multiline_whitespace_before_semicolons":{"strategy":"new_line_for_chained_calls"},"no_alternative_syntax":true,"no_binary_string":true,"no_null_property_initialization":true,"no_short_echo_tag":true,"no_superfluous_elseif":true,"no_useless_else":true,"no_useless_return":true,"php_unit_internal_class":true,"php_unit_method_casing":true,"php_unit_ordered_covers":true,"php_unit_test_class_requires_covers":true,"phpdoc_add_missing_param_annotation":true,"phpdoc_no_empty_return":true,"phpdoc_order":true,"phpdoc_var_annotation_correct_order":true,"return_assignment":true,"no_unneeded_final_method":true},"hashes":{"mapBuilder\/zones\/list_mapcontext.zone.php":3680687115,"mapBuilder\/install\/upgrade_acl.php":3190192383,"mapBuilder\/install\/upgrade_toggleattributetable.php":3302829116,"mapBuilder\/install\/upgrade.php":1187839691,"mapBuilder\/install\/conf\/mapBuilder.ini.php":2668770549,"mapBuilder\/install\/upgrade_createtable.php":3503491225,"mapBuilder\/install\/install.php":3467583771,"mapBuilder\/classes\/mapBuilderView.listener.php":66970557,"mapBuilder\/classes\/listBaseLayer.class.php":2559677211,"mapBuilder\/classes\/listRepositories.class.php":713607706,"mapBuilder\/controllers\/mapcontext.classic.php":2158702172,"mapBuilder\/controllers\/default.classic.php":1609143851}}
77 changes: 38 additions & 39 deletions mapBuilder/classes/listBaseLayer.class.php
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
<?php
<?php

require_once (JELIX_LIB_PATH.'forms/jFormsDatasource.class.php');
require_once JELIX_LIB_PATH.'forms/jFormsDatasource.class.php';

class listBaseLayer implements jIFormsDatasource
{
protected $formId = 0;

protected $data = array();

function __construct($id)
{
$this->formId = $id;

$this->data = array(
'osmMapnik' => 'OSM Mapnik',
'osmStamenToner' => 'OSM Stamen Toner',
'osmCyclemap' => 'OSM Cyclemap',
'bingStreets' => 'Bing Streets',
'bingSatellite' => 'Bing Satellite',
'bingHybrid' => 'Bing Hybrid',
'ignTerrain' => 'IGN Terrain',
'ignStreets' => 'IGN Streets',
'ignSatellite' => 'IGN Satellite',
'ignCadastral' => 'IGN Cadastral',
'emptyBaselayer' => jLocale::get('view~dictionnary.baselayer.empty.title')
);
}

public function getData($form)
{
return ($this->data);
}

public function getLabel($key)
{
if(isset($this->data[$key]))
return $this->data[$key];
else
return null;
}

protected $formId = 0;

protected $data = array();

public function __construct($id)
{
$this->formId = $id;

$this->data = array(
'osmMapnik' => 'OSM Mapnik',
'osmStamenToner' => 'OSM Stamen Toner',
'osmCyclemap' => 'OSM Cyclemap',
'bingStreets' => 'Bing Streets',
'bingSatellite' => 'Bing Satellite',
'bingHybrid' => 'Bing Hybrid',
'ignTerrain' => 'IGN Terrain',
'ignStreets' => 'IGN Streets',
'ignSatellite' => 'IGN Satellite',
'ignCadastral' => 'IGN Cadastral',
'emptyBaselayer' => jLocale::get('view~dictionnary.baselayer.empty.title'),
);
}

public function getData($form)
{
return $this->data;
}

public function getLabel($key)
{
if (isset($this->data[$key])) {
return $this->data[$key];
}

return null;
}
}
?>
53 changes: 26 additions & 27 deletions mapBuilder/classes/listRepositories.class.php
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
<?php
<?php

require_once (JELIX_LIB_PATH.'forms/jFormsDatasource.class.php');
require_once JELIX_LIB_PATH.'forms/jFormsDatasource.class.php';

class listRepositories implements jIFormsDatasource
{
protected $formId = 0;
protected $formId = 0;

protected $data = array();
protected $data = array();

function __construct($id)
{
$this->formId = $id;
public function __construct($id)
{
$this->formId = $id;

$repositories = array();
$repositories = array();

foreach (lizmap::getRepositoryList() as $repositoryName) {
$repository = lizmap::getRepository($repositoryName);
if( jAcl2::check('lizmap.repositories.view', $repository->getKey() )){
$repositories[$repository->getKey()] = $repository->getData('label');
foreach (lizmap::getRepositoryList() as $repositoryName) {
$repository = lizmap::getRepository($repositoryName);
if (jAcl2::check('lizmap.repositories.view', $repository->getKey())) {
$repositories[$repository->getKey()] = $repository->getData('label');
}
}
}

$this->data = $repositories;
}
$this->data = $repositories;
}

public function getData($form)
{
return ($this->data);
}
public function getData($form)
{
return $this->data;
}

public function getLabel($key)
{
if(isset($this->data[$key]))
return $this->data[$key];
else
return null;
}
public function getLabel($key)
{
if (isset($this->data[$key])) {
return $this->data[$key];
}

return null;
}
}
?>
41 changes: 21 additions & 20 deletions mapBuilder/classes/mapBuilderView.listener.php
Original file line number Diff line number Diff line change
@@ -1,52 +1,53 @@
<?php
class mapBuilderViewListener extends jEventListener{

function onmainviewGetMaps ($event) {
class mapBuilderViewListener extends jEventListener
{
public function onmainviewGetMaps($event)
{

// Access control
if( jAcl2::check("mapBuilder.access") ){
if (jAcl2::check('mapBuilder.access')) {
$name = jLocale::get('mapBuilder~default.app.name');
$access = jLocale::get('mapBuilder~default.app.access');
$description = jLocale::get('mapBuilder~default.app.description');

// Default extent is metropolitan France in EPSG:3857.
$extent = '-517635.63,6742470.88,1013007.37,4957918.98';
// Read mapBuilder configuration
$readConfigPath = parse_ini_file(jApp::configPath('mapBuilder.ini.php'), True);
$readConfigPath = parse_ini_file(jApp::configPath('mapBuilder.ini.php'), true);
// Get original extent from ini file if set
if(array_key_exists('extent', $readConfigPath)){
if (array_key_exists('extent', $readConfigPath)) {
// Reproject extent in ini file from EPSG:4326 to EPSG:3857.
$proj4 = new Proj4php();
$sourceProj = new Proj4phpProj('EPSG:4326', $proj4);
$destProj = new Proj4phpProj('EPSG:3857', $proj4);
$destProj = new Proj4phpProj('EPSG:3857', $proj4);

$extentArraySource = explode(",", $readConfigPath['extent']);
$extentArraySource = explode(',', $readConfigPath['extent']);

// Is extent valid ?
if(count($extentArraySource) == 4 && $extentArraySource === array_filter($extentArraySource, 'is_numeric')){
if (count($extentArraySource) == 4 && $extentArraySource === array_filter($extentArraySource, 'is_numeric')) {
// Cast as float
$extentArraySource = array_map('floatval', $extentArraySource);

// Handle WGS84 bounds
$sourceMinPt = new proj4phpPoint( max($extentArraySource[0], -180.0), max($extentArraySource[1], -85.06) );
$sourceMaxPt = new proj4phpPoint( min($extentArraySource[2], 180.0), min($extentArraySource[3], 85.06) );
$sourceMinPt = new proj4phpPoint(max($extentArraySource[0], -180.0), max($extentArraySource[1], -85.06));
$sourceMaxPt = new proj4phpPoint(min($extentArraySource[2], 180.0), min($extentArraySource[3], 85.06));

try {
$destMinPt = $proj4->transform($sourceProj,$destProj,$sourceMinPt);
$destMaxPt = $proj4->transform($sourceProj,$destProj,$sourceMaxPt);

$extent = implode(", ", array( $destMinPt->x, $destMinPt->y, $destMaxPt->x, $destMaxPt->y ));
$destMinPt = $proj4->transform($sourceProj, $destProj, $sourceMinPt);
$destMaxPt = $proj4->transform($sourceProj, $destProj, $sourceMaxPt);

$extent = implode(', ', array($destMinPt->x, $destMinPt->y, $destMaxPt->x, $destMaxPt->y));
} catch (Exception $e) {
// Max extent in EPSG:3857
$extent = "-20026376.39,-20048966.10,20026376.39,20048966.10";
$extent = '-20026376.39,-20048966.10,20026376.39,20048966.10';
}
}else{
jMessage::add(jLocale::get("mapBuilder~default.extent.value.error"), 'error');
$extent = jLocale::get("mapBuilder~default.extent.value.error");
} else {
jMessage::add(jLocale::get('mapBuilder~default.extent.value.error'), 'error');
$extent = jLocale::get('mapBuilder~default.extent.value.error');
}
}

$illustration = jApp::urlBasePath().'themes/'.jApp::config()->theme.'/css/img/250x250_mappemonde.jpg';

jClasses::inc('lizmapMainViewItem');
Expand All @@ -64,7 +65,7 @@ function onmainviewGetMaps ($event) {
'_map_builder_rep',
'map'
);
$event->add( $mrep );
$event->add($mrep);
}
}
}
Loading

0 comments on commit bd11bea

Please sign in to comment.