Completed
Push — master ( 00e474...9d3fbd )
by Michael
04:26
created

Oledrion_shelf::getProducts()   F

Complexity

Conditions 34
Paths > 20000

Size

Total Lines 210
Code Lines 148

Duplication

Lines 18
Ratio 8.57 %

Importance

Changes 0
Metric Value
cc 34
eloc 148
nc 272077
nop 1
dl 18
loc 210
rs 2
c 0
b 0
f 0

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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
 * Facade pour les produits
22
 */
23
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

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.

Loading history...
24
25
class Oledrion_shelf
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
26
{
27
    private $handlers;
28
29
    /**
30
     * Oledrion_shelf constructor.
31
     */
32
    public function __construct()
33
    {
34
        $this->initHandlers();
35
    }
36
37
    /**
38
     * Chargement des handlers
39
     */
40
    private function initHandlers()
41
    {
42
        $this->handlers = OledrionHandler::getInstance();
43
    }
44
45
    /**
46
     * Retourne le nombre de produits d'un certain type
47
     *
48
     * @param  string $type Le type de produits dont on veut récupérer le nombre
49
     * @param  int    $category
50
     * @param  int    $excluded
51
     * @return int
52
     */
53
    public function getProductsCount($type = 'recent', $category = 0, $excluded = 0)
54
    {
55
        switch (strtolower($type)) {
56
            case 'recent':
57
                return $this->handlers->h_oledrion_products->getRecentProductsCount($category, $excluded);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
58
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
59
        }
60
61
        return 0;
62
    }
63
64
    /**
65
     * Supprime un produit (et tout ce qui lui est relatif)
66
     * @param oledrion_products $product
67
     */
68
    public function deleteProduct(Oledrion_products $product)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
69
    {
70
        global $xoopsModule;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
71
        $id = $product->getVar('product_id');
72
73
        // On commence par supprimer les commentaires
74
        $mid = $xoopsModule->getVar('mid');
75
        xoops_comment_delete($mid, $id);
76
77
        // Puis les votes
78
        $this->handlers->h_oledrion_votedata->deleteProductRatings($id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_votedata does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
79
80
        // Puis les produits relatifs
81
        $this->handlers->h_oledrion_related->deleteProductRelatedProducts($id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_related does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
82
83
        // Les images (la grande et la miniature)
84
        $product->deletePictures();
85
86
        // Le fichier attaché
87
        $product->deleteAttachment();
88
89
        // Les fichiers attachés
90
        $this->handlers->h_oledrion_files->deleteProductFiles($id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_files does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
91
92
        // Suppression dans les paniers persistants enregistrés
93
        $this->handlers->h_oledrion_persistent_cart->deleteProductForAllCarts($id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_persistent_cart does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
94
95
        // Les attributs qui lui sont rattachés
96
        $this->handlers->h_oledrion_attributes->deleteProductAttributes($id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_attributes does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
97
98
        // Le produit dans les listes
99
        $this->handlers->h_oledrion_products_list->deleteProductFromLists($id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products_list does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
100
101
        // La relation entre le produit et le fabricant
102
        $this->handlers->h_oledrion_productsmanu->removeManufacturerProduct($id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_productsmanu does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
103
104
        // Le produit dans les remises
105
        $this->handlers->h_oledrion_discounts->removeProductFromDiscounts($id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_discounts does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
106
107
        // Et le produit en lui même, à la fin
108
        return $this->handlers->h_oledrion_products->delete($product, true);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
109
    }
110
111
    /**
112
     * Cherche et retourne la liste de produits relatifs à une liste de produits
113
     *
114
     * @param  array $productsIds La liste des produits dont on cherche les produits relatifs
115
     * @return array Clé = ID Produit, valeurs (deuxième dimension) = liste des produits relatifs
116
     */
117
    private function getRelatedProductsFromProductsIds($productsIds)
118
    {
119
        $relatedProducts = $relatedProductsIds = array();
0 ignored issues
show
Unused Code introduced by
$relatedProductsIds is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
120
        if (is_array($productsIds) && count($productsIds) > 0) {
121
            $relatedProductsIds = $this->handlers->h_oledrion_related->getRelatedProductsFromProductsIds($productsIds);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_related does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
122
            if (count($relatedProductsIds) > 0) {
123
                $tmp = array();
124
                foreach ($relatedProductsIds as $relatedProductId) {
125
                    $tmp[] = $relatedProductId->getVar('related_product_related');
126
                }
127
                $tmp = array_unique($tmp);
128
                sort($tmp);
129
                if (count($tmp) > 0) {
130
                    $tempRelatedProducts = $this->handlers->h_oledrion_products->getProductsFromIDs($tmp);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
131
                    foreach ($relatedProductsIds as $relatedProductId) {
132
                        if (isset($tempRelatedProducts[$relatedProductId->getVar('related_product_related')])) {
133
                            $relatedProducts[$relatedProductId->getVar('related_product_id')][] = $tempRelatedProducts[$relatedProductId->getVar('related_product_related')];
134
                        }
135
                    }
136
                }
137
            }
138
        }
139
140
        return $relatedProducts;
141
    }
142
143
    /**
144
     * Retourne une liste de produits selon certains critères
145
     *
146
     * @param  oledrion_shelf_parameters $parameters Les paramètres de filtrage
147
     * @return array                     Tableau prêt à être utilisé dans les templates
148
     */
149
    public function getProducts(Oledrion_shelf_parameters $parameters)
150
    {
151
        global $vatArray;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
152
        $parametersValues    = $parameters->getParameters();
153
        $productType         = $parametersValues['productsType'];
154
        $start               = $parametersValues['start'];
155
        $limit               = $parametersValues['limit'];
156
        $category            = $parametersValues['category'];
157
        $sort                = $parametersValues['sort'];
158
        $order               = $parametersValues['order'];
159
        $excluded            = $parametersValues['excluded'];
160
        $withXoopsUser       = $parametersValues['withXoopsUser'];
161
        $withRelatedProducts = $parametersValues['withRelatedProducts'];
162
        $withQuantity        = $parametersValues['withQuantity'];
163
        $thisMonthOnly       = $parametersValues['thisMonthOnly'];
164
        $ret                 = $xoopsUsersIDs = $users = $relatedProducts = $productsManufacturers = $manufacturersPerProduct = $products = $productsIds = $categoriesIds = $vendorsIds = $manufacturersIds = $manufacturers = $categories = $vendors = array();
0 ignored issues
show
Unused Code introduced by
$productsIds is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
Unused Code introduced by
$productsManufacturers is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
165
        // On commence par récupérer la liste des produits
166
        switch (strtolower($productType)) {
167
            case 'recent':
168
                $products = $this->handlers->h_oledrion_products->getRecentProducts(new Oledrion_parameters(array(
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
169
                                                                                                                'start'         => $start,
170
                                                                                                                'limit'         => $limit,
171
                                                                                                                'category'      => $category,
172
                                                                                                                'sort'          => $sort,
173
                                                                                                                'order'         => $order,
174
                                                                                                                'excluded'      => $excluded,
175
                                                                                                                'thisMonthOnly' => $thisMonthOnly
176
                                                                                                            )));
177
                break;
178
179
            case 'mostsold':
180
                $tempProductsIds = array();
0 ignored issues
show
Unused Code introduced by
$tempProductsIds is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
181
                $tempProductsIds = $this->handlers->h_oledrion_caddy->getMostSoldProducts($start, $limit, $category, $withQuantity);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_caddy does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
182
                if (count($tempProductsIds) > 0) {
183
                    $products = $this->handlers->h_oledrion_products->getProductsFromIDs(array_keys($tempProductsIds));
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
184
                }
185
                break;
186
187
            case 'recentlysold':
188
                $tempProductsIds = array();
0 ignored issues
show
Unused Code introduced by
$tempProductsIds is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
189
                $tempProductsIds = $this->handlers->h_oledrion_caddy->getRecentlySoldProducts($start, $limit);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_caddy does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
190
                if (count($tempProductsIds) > 0) {
191
                    $tempProductsIds = array_unique($tempProductsIds);
192
                }
193
                if (count($tempProductsIds) > 0) {
194
                    $products = $this->handlers->h_oledrion_products->getProductsFromIDs(array_keys($tempProductsIds));
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
195
                }
196
                break;
197
198 View Code Duplication
            case 'mostviewed':
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
199
                $products = $this->handlers->h_oledrion_products->getMostViewedProducts(new Oledrion_parameters(array(
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
200
                                                                                                                    'start'    => $start,
201
                                                                                                                    'limit'    => $limit,
202
                                                                                                                    'category' => $category,
203
                                                                                                                    'sort'     => $sort,
204
                                                                                                                    'order'    => $order
205
                                                                                                                )));
206
                break;
207
208 View Code Duplication
            case 'bestrated':
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
209
                $products = $this->handlers->h_oledrion_products->getBestRatedProducts(new Oledrion_parameters(array(
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
210
                                                                                                                   'start'    => $start,
211
                                                                                                                   'limit'    => $limit,
212
                                                                                                                   'category' => $category,
213
                                                                                                                   'sort'     => $sort,
214
                                                                                                                   'order'    => $order
215
                                                                                                               )));
216
                break;
217
218 View Code Duplication
            case 'recommended':
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
219
                $products = $this->handlers->h_oledrion_products->getRecentRecommended(new Oledrion_parameters(array(
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
220
                                                                                                                   'start'    => $start,
221
                                                                                                                   'limit'    => $limit,
222
                                                                                                                   'category' => $category,
223
                                                                                                                   'sort'     => $sort,
224
                                                                                                                   'order'    => $order
225
                                                                                                               )));
226
                break;
227
228 View Code Duplication
            case 'promotional':
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
229
                $products = $this->handlers->h_oledrion_products->getPromotionalProducts(new Oledrion_parameters(array(
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
230
                                                                                                                     'start'    => $start,
231
                                                                                                                     'limit'    => $limit,
232
                                                                                                                     'category' => $category,
233
                                                                                                                     'sort'     => $sort,
234
                                                                                                                     'order'    => $order
235
                                                                                                                 )));
236
                break;
237
238 View Code Duplication
            case 'random':
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
239
                $products = $this->handlers->h_oledrion_products->getRandomProducts(new Oledrion_parameters(array(
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
240
                                                                                                                'start'         => $start,
241
                                                                                                                'limit'         => $limit,
242
                                                                                                                'category'      => $category,
243
                                                                                                                'sort'          => $sort,
244
                                                                                                                'order'         => $order,
245
                                                                                                                'thisMonthOnly' => $thisMonthOnly
246
                                                                                                            )));
247
        }
248
249
        if (count($products) > 0) {
250
            $productsIds = array_keys($products);
251
        } else {
252
            return $ret;
253
        }
254
255
        // Recherche des Id des catégories et des vendeurs
256
        foreach ($products as $product) {
257
            $categoriesIds[] = $product->getVar('product_cid');
258
            $vendorsIds[]    = $product->getVar('product_vendor_id');
259
            if ($withXoopsUser) {
260
                $xoopsUsersIDs[] = $product->getVar('product_submitter');
261
            }
262
        }
263
264
        $productsManufacturers = $this->handlers->h_oledrion_productsmanu->getFromProductsIds($productsIds);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_productsmanu does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
265
        // Regroupement des fabricants par produit
266 View Code Duplication
        foreach ($productsManufacturers as $item) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
267
            $manufacturersIds[]                                        = $item->getVar('pm_manu_id');
268
            $manufacturersPerProduct[$item->getVar('pm_product_id')][] = $item;
269
        }
270
        // On récupère la liste des personnes qui ont soumis les produits
271
        if ($withXoopsUser) {
272
            $users = Oledrion_utils::getUsersFromIds($xoopsUsersIDs);
273
        }
274
275
        // Il faut récupérer la liste des produits relatifs
276
        if ($withRelatedProducts) {
277
            $relatedProducts = $this->getRelatedProductsFromProductsIds($productsIds);
278
        }
279
280
        $categoriesIds = array_unique($categoriesIds);
281
        sort($categoriesIds);
282
283
        $vendorsIds = array_unique($vendorsIds);
284
        sort($vendorsIds);
285
286
        $manufacturersIds = array_unique($manufacturersIds);
287
        sort($manufacturersIds);
288
289
        // Récupération des fabricants, des vendeurs et des catégories
290
        if (count($manufacturersIds) > 0) {
291
            $manufacturers = $this->handlers->h_oledrion_manufacturer->getManufacturersFromIds($manufacturersIds);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_manufacturer does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
292
        }
293
        if (count($categoriesIds) > 0) {
294
            $categories = $this->handlers->h_oledrion_cat->getCategoriesFromIds($categoriesIds);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_cat does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
295
        }
296
        if (count($vendorsIds) > 0) {
297
            $vendors = $this->handlers->h_oledrion_vendors->getVendorsFromIds($vendorsIds);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_vendors does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
298
        }
299
300
        $count     = 1;
301
        $lastTitle = '';
302
        foreach ($products as $product) {
303
            $tmp       = array();
0 ignored issues
show
Unused Code introduced by
$tmp is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
304
            $tmp       = $product->toArray();
305
            $lastTitle = $product->getVar('product_title');
306
            // Le vendeur
307
            if (isset($vendors[$product->getVar('product_vendor_id')])) {
308
                $tmp['product_vendor'] = $vendors[$product->getVar('product_vendor_id')]->toArray();
309
            }
310
            // La catégorie
311
            if (isset($categories[$product->getVar('product_cid')])) {
312
                $tmp['product_category'] = $categories[$product->getVar('product_cid')]->toArray();
313
            }
314
            // Les produits relatifs
315
            if ($withRelatedProducts) {
316
                if (isset($relatedProducts[$product->getVar('product_id')])) {
317
                    $productsRelatedToThisOne = $relatedProducts[$product->getVar('product_id')];
318
                    foreach ($productsRelatedToThisOne as $oneRelatedProdut) {
319
                        $tmp['product_related_products'][] = $oneRelatedProdut->toArray();
320
                    }
321
                }
322
            }
323
            // Les fabricants du produit
324
            if (isset($manufacturersPerProduct[$product->getVar('product_id')])) {
325
                $productManufacturers = $manufacturersPerProduct[$product->getVar('product_id')];
326
                $tmpManufacturersList = array();
327
                foreach ($productManufacturers as $productManufacturer) {
328
                    if (isset($manufacturers[$productManufacturer->getVar('pm_manu_id')])) {
329
                        $manufacturer                   = $manufacturers[$productManufacturer->getVar('pm_manu_id')];
330
                        $tmp['product_manufacturers'][] = $manufacturer->toArray();
331
                        $tmpManufacturersList[]         = $manufacturer->getVar('manu_commercialname') . ' ' . $manufacturer->getVar('manu_name');
332
                    }
333
                }
334
                if (count($tmpManufacturersList) > 0) {
335
                    $tmp['product_joined_manufacturers'] = implode(OLEDRION_STRING_TO_JOIN_MANUFACTURERS, $tmpManufacturersList);
336
                }
337
            }
338
339
            // L'utilisateur Xoops (éventuellement)
340
            if ($withXoopsUser && isset($users[$product->getVar('product_submitter')])) {
341
                $thisUser = $users[$product->getVar('product_submitter')];
342
                if (xoops_trim($thisUser->getVar('name')) != '') {
343
                    $name = $thisUser->getVar('name');
344
                } else {
345
                    $name = $thisUser->getVar('uname');
346
                }
347
                $tmp['product_submiter_name'] = $name;
348
                $userLink                     = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $thisUser->getVar('uid') . '">' . $name . '</a>';
349
                $tmp['product_submiter_link'] = $userLink;
350
            }
351
            $tmp['product_count'] = $count; // Compteur pour les templates (pour gérer les colonnes)
352
            $ret[]                = $tmp;
353
            ++$count;
354
        }
355
        $ret['lastTitle'] = $lastTitle;
356
357
        return $ret;
358
    }
359
}
360