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 Hossein Azizabadi ([email protected]) |
||
| 18 | */ |
||
| 19 | |||
| 20 | require __DIR__ . '/classheader.php'; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Class Oledrion_location_delivery |
||
| 24 | */ |
||
| 25 | View Code Duplication | class Oledrion_location_delivery extends Oledrion_Object |
|
| 26 | { |
||
| 27 | /** |
||
| 28 | * constructor |
||
| 29 | * |
||
| 30 | * normally, this is called from child classes only |
||
| 31 | * |
||
| 32 | * @access public |
||
| 33 | */ |
||
| 34 | public function __construct() |
||
| 35 | { |
||
| 36 | $this->initVar('ld_id', XOBJ_DTYPE_INT, null, false); |
||
| 37 | $this->initVar('ld_location', XOBJ_DTYPE_INT, null, false); |
||
| 38 | $this->initVar('ld_delivery', XOBJ_DTYPE_INT, null, false); |
||
| 39 | $this->initVar('ld_price', XOBJ_DTYPE_INT, null, false); |
||
| 40 | $this->initVar('ld_delivery_time', XOBJ_DTYPE_INT, null, false); |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Retourne les éléments du produits formatés pour affichage |
||
| 45 | * |
||
| 46 | * @param string $format |
||
| 47 | * @return array |
||
| 48 | */ |
||
| 49 | public function toArray($format = 's') |
||
| 50 | { |
||
| 51 | $ret = array(); |
||
|
0 ignored issues
–
show
|
|||
| 52 | $ret = parent::toArray($format); |
||
| 53 | |||
| 54 | return $ret; |
||
| 55 | } |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Class OledrionOledrion_location_deliveryHandler |
||
| 60 | */ |
||
| 61 | class OledrionOledrion_location_deliveryHandler extends Oledrion_XoopsPersistableObjectHandler |
||
| 62 | { |
||
| 63 | /** |
||
| 64 | * OledrionOledrion_location_deliveryHandler constructor. |
||
| 65 | * @param XoopsDatabase|null $db |
||
| 66 | */ |
||
| 67 | public function __construct(XoopsDatabase $db) |
||
| 68 | { // Table Classe Id |
||
| 69 | parent::__construct($db, 'oledrion_location_delivery', 'oledrion_location_delivery', 'ld_id'); |
||
| 70 | } |
||
| 71 | |||
| 72 | /** |
||
| 73 | * @param $parameters |
||
| 74 | * @return array |
||
| 75 | */ |
||
| 76 | View Code Duplication | public function getLocationDeliveryId($parameters) |
|
| 77 | { |
||
| 78 | $ret = array(); |
||
| 79 | if (!$parameters['location']) { |
||
| 80 | return $ret; |
||
| 81 | } |
||
| 82 | $critere = new CriteriaCompo(); |
||
| 83 | $critere->add(new Criteria('ld_location', $parameters['location'])); |
||
| 84 | $obj = $this->getObjects($critere); |
||
| 85 | if ($obj) { |
||
| 86 | foreach ($obj as $root) { |
||
| 87 | $tab = array(); |
||
| 88 | $tab = $root->toArray(); |
||
| 89 | $ret[$root->getVar('ld_delivery')] = $tab; |
||
| 90 | } |
||
| 91 | } |
||
| 92 | |||
| 93 | return $ret; |
||
| 94 | } |
||
| 95 | |||
| 96 | /** |
||
| 97 | * @param $ld_delivery |
||
| 98 | * @param $ld_location |
||
| 99 | * @return array |
||
| 100 | */ |
||
| 101 | public function getDelivery($ld_delivery, $ld_location) |
||
| 102 | { |
||
| 103 | $ret = array(); |
||
| 104 | $critere = new CriteriaCompo(); |
||
| 105 | $critere->add(new Criteria('ld_delivery', $ld_delivery)); |
||
| 106 | $critere->add(new Criteria('ld_location', $ld_location)); |
||
| 107 | $critere->setLimit(1); |
||
| 108 | $obj = $this->getObjects($critere); |
||
| 109 | if ($obj) { |
||
| 110 | foreach ($obj as $root) { |
||
| 111 | $tab = array(); |
||
| 112 | $ret = $root->toArray(); |
||
| 113 | } |
||
| 114 | } |
||
| 115 | |||
| 116 | return $ret; |
||
| 117 | } |
||
| 118 | } |
||
| 119 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.