XoopsModules25x /
oledrion
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /* |
||
| 3 | You may not change or alter any portion of this comment or credits |
||
| 4 | of supporting developers from this source code or any supporting source code |
||
| 5 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 6 | |||
| 7 | This program is distributed in the hope that it will be useful, |
||
| 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 10 | */ |
||
| 11 | |||
| 12 | /** |
||
| 13 | * oledrion |
||
| 14 | * |
||
| 15 | * @copyright {@link http://xoops.org/ XOOPS Project} |
||
| 16 | * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
||
| 17 | * @author Hervé Thouzard (http://www.herve-thouzard.com/) |
||
| 18 | */ |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Chargement des handlers utilisés par le module |
||
| 22 | */ |
||
| 23 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
||
|
0 ignored issues
–
show
|
|||
| 24 | |||
| 25 | class OledrionHandler |
||
| 26 | { |
||
| 27 | /** |
||
| 28 | * Contient la liste des handlers disponibles |
||
| 29 | * |
||
| 30 | * @var array |
||
| 31 | */ |
||
| 32 | private $handlersNames = array( |
||
| 33 | 'oledrion_manufacturer', |
||
| 34 | 'oledrion_products', |
||
| 35 | 'oledrion_productsmanu', |
||
| 36 | 'oledrion_caddy', |
||
| 37 | 'oledrion_cat', |
||
| 38 | 'oledrion_commands', |
||
| 39 | 'oledrion_related', |
||
| 40 | 'oledrion_vat', |
||
| 41 | 'oledrion_votedata', |
||
| 42 | 'oledrion_discounts', |
||
| 43 | 'oledrion_vendors', |
||
| 44 | 'oledrion_files', |
||
| 45 | 'oledrion_persistent_cart', |
||
| 46 | 'oledrion_gateways_options', |
||
| 47 | 'oledrion_attributes', |
||
| 48 | 'oledrion_caddy_attributes', |
||
| 49 | 'oledrion_products_list', |
||
| 50 | 'oledrion_lists', |
||
| 51 | 'oledrion_delivery', |
||
| 52 | 'oledrion_location', |
||
| 53 | 'oledrion_packing', |
||
| 54 | 'oledrion_payment', |
||
| 55 | 'oledrion_location_delivery', |
||
| 56 | 'oledrion_delivery_payment', |
||
| 57 | 'oledrion_payment_log' |
||
| 58 | ); |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Contient l'unique instance de l'objet |
||
| 62 | * @var object |
||
| 63 | */ |
||
| 64 | private static $instance = false; |
||
|
0 ignored issues
–
show
|
|||
| 65 | |||
| 66 | /** |
||
| 67 | * Réceptacle des handlers |
||
| 68 | * |
||
| 69 | * @var array |
||
| 70 | */ |
||
| 71 | public $handlers = null; |
||
| 72 | |||
| 73 | /** |
||
| 74 | * Méthode chargée de renvoyer les handlers de données en les chargeant à la volée |
||
| 75 | * |
||
| 76 | * @param string $name |
||
| 77 | * @return mixed Null si on échoue, sinon l'objet demandé |
||
| 78 | */ |
||
| 79 | public function __get($name) |
||
| 80 | { |
||
| 81 | if (substr($name, 0, 2) !== 'h_') { |
||
| 82 | return null; |
||
| 83 | } |
||
| 84 | if (!in_array(substr($name, 2), $this->handlersNames)) { |
||
| 85 | return null; |
||
| 86 | } |
||
| 87 | if (!isset($this->handlersNames[$name])) { |
||
| 88 | $this->handlers[$name] = xoops_getModuleHandler(substr($name, 2), OLEDRION_DIRNAME); |
||
| 89 | } |
||
| 90 | |||
| 91 | return $this->handlers[$name]; |
||
| 92 | } |
||
| 93 | |||
| 94 | /** |
||
| 95 | * OledrionHandler constructor. |
||
| 96 | */ |
||
| 97 | private function __construct() |
||
| 98 | { |
||
| 99 | $this->handlers = array(); |
||
| 100 | } |
||
| 101 | |||
| 102 | /** |
||
| 103 | * Retourne l'instance unique de la classe |
||
| 104 | * |
||
| 105 | * @return object |
||
| 106 | */ |
||
| 107 | public static function getInstance() |
||
| 108 | { |
||
| 109 | static $instance; |
||
| 110 | if (null === $instance) { |
||
| 111 | $instance = new static(); |
||
| 112 | } |
||
| 113 | |||
| 114 | return $instance; |
||
| 115 | } |
||
| 116 | } |
||
| 117 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.