Skip to content

Commit

Permalink
Fix license headers, use GLPI phpcs configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher committed Jan 21, 2025
1 parent da0dfec commit 2517218
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 186 deletions.
20 changes: 20 additions & 0 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<ruleset>
<file>lib</file>
<file>tests</file>
<exclude-pattern>/.git/</exclude-pattern>

<arg name="warning-severity" value="0" />
<arg value="p" />
<ini name="memory_limit" value="512M" />
<arg name="colors" />
<arg name="extensions" value="php" />

<rule ref="PSR12">
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
</rule>

<rule ref="Generic.Arrays.ArrayIndent"></rule>
</ruleset>
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020-2021 Teclib' and contributors
Copyright (c) 2020-2025 Teclib' and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
43 changes: 4 additions & 39 deletions lib/php/Converter.php
Original file line number Diff line number Diff line change
@@ -1,42 +1,12 @@
<?php

/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2025 Teclib' and contributors.
* © Teclib' and contributors.
*
* http://glpi-project.org
* This file is part of GLPI inventory format.
*
* based on GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* GLPI is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GLPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GLPI. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*
* PHP version 7
*
* @category Inventory
* @package Glpi
* @author Johan Cwiklinski <[email protected]>
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link https://glpi-project.org
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Glpi\Inventory;
Expand All @@ -52,12 +22,7 @@
* Converts old FusionInventory XML format to new JSON schema
* for automatic inventory.
*
* @category Inventory
* @package Glpi
* @author Johan Cwiklinski <[email protected]>
* @copyright 2018-2025 GLPI Team and Contributors
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link https://glpi-project.org
*/
class Converter
{
Expand Down
47 changes: 6 additions & 41 deletions lib/php/FilesToJSON.php
Original file line number Diff line number Diff line change
@@ -1,58 +1,23 @@
<?php

/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2018 Teclib' and contributors.
* © Teclib' and contributors.
*
* http://glpi-project.org
* This file is part of GLPI inventory format.
*
* based on GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* GLPI is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GLPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GLPI. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*
* PHP version 7
*
* @category Inventory
* @package Glpi
* @author Johan Cwiklinski <[email protected]>
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link https://glpi-project.org
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Glpi\Inventory;

use RuntimeException;

/**
* Converts old FusionInventory XML format to new JSON schema
* Converts specific texts list files to JSON format
* for automatic inventory.
*
* @category Inventory
* @package Glpi
* @author Johan Cwiklinski <[email protected]>
* @copyright 2018-2023 GLPI Team and Contributors
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link https://glpi-project.org
*/
final class FilesToJSON
{
Expand Down Expand Up @@ -387,7 +352,7 @@ private function callCurl(string $url): string
throw new RuntimeException($msgerr);
}

//force cast to made phpstan happy, but return is always string here
//force cast to make phpstan happy, but return is always string here
return (string)$content;
}
}
38 changes: 8 additions & 30 deletions tests/Glpi/Inventory/tests/units/Converter.php
Original file line number Diff line number Diff line change
@@ -1,41 +1,20 @@
<?php

/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2018 Teclib' and contributors.
*
* http://glpi-project.org
*
* based on GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
*
* ---------------------------------------------------------------------
*
* LICENSE
* © Teclib' and contributors.
*
* This file is part of GLPI.
* This file is part of GLPI inventory format.
*
* GLPI is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GLPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GLPI. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*/
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Glpi\Inventory\tests\units;

use PHPUnit\Framework\TestCase;

class Converter extends TestCase {

class Converter extends TestCase
{
/**
* Test constructor
*
Expand Down Expand Up @@ -774,7 +753,6 @@ public function testValidateExtraPlugin_node(): void
$instance = new \Glpi\Inventory\Converter();
$this->assertInstanceOf(\Glpi\Inventory\Converter::class, $instance->setExtraProperties($extra_prop));
$this->assertTrue($instance->validate($json));

}

public function testValidateUnknownHwPlugin_node(): void
Expand Down
44 changes: 5 additions & 39 deletions tests/Glpi/Inventory/tests/units/FilesToJSON.php
Original file line number Diff line number Diff line change
@@ -1,41 +1,12 @@
<?php

/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2018 Teclib' and contributors.
*
* http://glpi-project.org
*
* based on GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
*
* ---------------------------------------------------------------------
*
* LICENSE
* © Teclib' and contributors.
*
* This file is part of GLPI.
* This file is part of GLPI inventory format.
*
* GLPI is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GLPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GLPI. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*
* PHP version 7
*
* @category Inventory
* @package Glpi
* @author Johan Cwiklinski <[email protected]>
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link https://glpi-project.org
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Glpi\Inventory\tests\units;
Expand All @@ -45,12 +16,7 @@
/**
* Tests for hardware file conversions
*
* @category Inventory
* @package GlpiTests
* @author Johan Cwiklinski <[email protected]>
* @copyright 2019 GLPI Team and Contributors
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link https://glpi-project.org
*/
class FilesToJSON extends TestCase
{
Expand Down
40 changes: 4 additions & 36 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,44 +1,12 @@
<?php

/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2018 Teclib' and contributors.
* © Teclib' and contributors.
*
* http://glpi-project.org
* This file is part of GLPI inventory format.
*
* based on GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* GLPI is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GLPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GLPI. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*
* PHP version 7
*
* @category Tests
* @package Glpi
*
* @author Johan Cwiklinski <[email protected]>
* @copyright 2018 GLPI Team and Contributors
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link https://glpi-project.org
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

require_once __DIR__ . '/../vendor/autoload.php';
Expand Down

0 comments on commit 2517218

Please sign in to comment.