Completed
Branch master (00e474)
by Michael
05:07
created

my-lists.php ➔ listForm()   C

Complexity

Conditions 12
Paths 153

Size

Total Lines 72
Code Lines 56

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 12
eloc 56
nc 153
nop 2
dl 0
loc 72
rs 5.0906
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
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 49 and the first side effect is on line 24.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
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   The XOOPS Project http://sourceforge.net/projects/xoops/
16
 * @license     http://www.fsf.org/copyleft/gpl.html GNU public license
17
 * @author      Hervé Thouzard (http://www.herve-thouzard.com/)
18
 * @version     $Id: my-lists.php 12290 2014-02-07 11:05:17Z beckmi $
19
 */
20
21
/**
22
 * Liste des listes de l'utilisateur
23
 */
24
require 'header.php';
25
$GLOBALS['current_category'] = -1;
26
$xoopsOption['template_main'] = 'oledrion_mylists.tpl';
27
require_once XOOPS_ROOT_PATH . '/header.php';
28
require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
29
30
$uid = oledrion_utils::getCurrentUserID();
31
if ($uid == 0) {
32
    oledrion_utils::redirect(_OLEDRION_ERROR23, XOOPS_URL . '/register.php', 4);
33
}
34
35
$baseurl = OLEDRION_URL . basename(__FILE__); // URL de ce script
36
$handlers = oledrion_handler::getInstance();
37 View Code Duplication
if (isset($_GET['op'])) {
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...
38
    $op = $_GET['op'];
39
} elseif (isset($_POST['op'])) {
40
    $op = $_POST['op'];
41
} else {
42
    $op = 'default';
43
}
44
$xoopsTpl->assign('baseurl', $baseurl);
45
oledrion_utils::loadLanguageFile('modinfo.php');
46
oledrion_utils::loadLanguageFile('admin.php');
47
$breadcrumb = '';
48
49
function listForm($op, $product_id = 0)
0 ignored issues
show
Coding Style introduced by
listForm uses the super-global variable $_GET which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
50
{
51
    global $handlers, $baseurl;
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...
52
    if ($op == 'edit') {
53
        $title = _OLEDRION_EDIT_LIST;
54
        $label_submit = _AM_OLEDRION_MODIFY;
0 ignored issues
show
Unused Code introduced by
$label_submit 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...
55
        $list_id = isset($_GET['list_id']) ? intval($_GET['list_id']) : 0;
56
        if (empty($list_id)) {
57
            oledrion_utils::redirect(_AM_OLEDRION_ERROR_21, $baseurl, 5);
58
        }
59
        $item = null;
0 ignored issues
show
Unused Code introduced by
$item 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...
60
        $item = $handlers->h_oledrion_lists->get($list_id);
61
        if (!is_object($item)) {
62
            oledrion_utils::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
63
        }
64
        // Vérification, est-ce que l'utilisateur courant est bien le propriétaire de cette liste ?
65
        if (!$handlers->h_oledrion_lists->isThisMyList($list_id)) {
66
            oledrion_utils::redirect(_OLEDRION_ERROR25, $baseurl, 8);
67
        }
68
        $edit = true;
69
        $label_submit = _AM_OLEDRION_MODIFY;
70
    } else {
71
        $title = _OLEDRION_ADD_LIST;
72
        $label_submit = _AM_OLEDRION_ADD;
73
        $item = $handlers->h_oledrion_lists->create(true);
74
        $edit = false;
75
    }
76
77
    $sform = new XoopsThemeForm($title, 'frmList', $baseurl);
78
    $sform->addElement(new XoopsFormHidden('op', 'save'));
79
    $sform->addElement(new XoopsFormHidden('list_id', $item->getVar('list_id')));
80
    $sform->addElement(new XoopsFormText(_AM_OLEDRION_TITLE, 'list_title', 50, 255, $item->getVar('list_title', 'e')), true);
81
    //$sform->addElement(new XoopsFormText(_OLEDRION_LIST_PASSWORD, 'list_password', 50, 50, $item->getVar('list_password','e')), false);
0 ignored issues
show
Unused Code Comprehensibility introduced by
71% 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...
82
    $selectTypes = oledrion_lists::getTypesArray();
83
    $selectType = new XoopsFormSelect(_OLEDRION_LIST_TYPE, 'list_type', $item->getVar('list_type', 'e'));
84
    $selectType->addOptionArray($selectTypes);
85
    $sform->addElement($selectType, true);
86
    $sform->addElement(new XoopsFormTextArea(_OLEDRION_DESCRIPTION, 'list_description', $item->getVar('list_description', 'e'), 7, 60), false);
87
    $listProducts = array();
0 ignored issues
show
Unused Code introduced by
$listProducts 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...
88
    if ($edit) {
89
        $listProducts = $handlers->h_oledrion_lists->getListProducts($item);
90
        if (count($listProducts) > 0) {
91
            $productsTray = new XoopsFormElementTray(_OLEDRION_PROD_IN_THIS_LIST, '<br />');
92
            $productsTray->addElement(new XoopsFormLabel(_OLEDRION_CHECK_PRODUCTS), false);
93
            foreach ($listProducts as $product) {
94
                $caption = "<a target='_blank' href='" . $product->getLink() . "'>" . $product->getVar('product_title') . '</a>';
95
                $checkbox = new XoopsFormCheckBox($caption, 'productsList[]');
96
                $checkbox->addOption($product->getVar('product_id'), _DELETE);
97
                $productsTray->addElement($checkbox);
98
                unset($caption, $checkbox);
99
            }
100
            $sform->addElement($productsTray, false);
101
        }
102
    }
103
    if ($product_id > 0) {
104
        $product = null;
0 ignored issues
show
Unused Code introduced by
$product 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...
105
        $product = $handlers->h_oledrion_products->get($product_id);
106
        if (is_object($product) && $product->isProductVisible()) {
107
            $content = "<a target='_blank' href='" . $product->getLink() . "'>" . $product->getVar('product_title') . '</a>';
108
            $sform->addElement(new XoopsFormLabel(_OLEDRION_PRODUCT_DO_ADD, $content));
109
            $sform->addElement(new XoopsFormHidden('product_id', $product_id));
110
        }
111
    }
112
    $button_tray = new XoopsFormElementTray('', '');
113
    $submit_btn = new XoopsFormButton('', 'post', $label_submit, 'submit');
114
    $button_tray->addElement($submit_btn);
115
    $sform->addElement($button_tray);
116
117
    $sform = oledrion_utils::formMarkRequiredFields($sform);
118
119
    return $sform;
120
}
121
122
switch ($op) {
123
    // ************************************************************************
124
    case 'default': // Liste de toutes les listes de l'utilisateur ************
125
        // ************************************************************************
126
        $xoopsTpl->assign('op', $op);
127
        $lists = array();
128
        $start = $limit = 0;
129
        $idAsKey = true;
130
        $lists = $handlers->h_oledrion_lists->getRecentLists(new oledrion_parameters(array('start' => $start, 'limit' => $limit, 'sort' => 'list_title', 'order' => 'ASC', 'idAsKey' => $idAsKey, 'listType' => OLEDRION_LISTS_ALL, 'list_uid' => $uid)));
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<oledrion_handler>. 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
        if (count($lists) > 0) {
132
            foreach ($lists as $list) {
133
                $xoopsTpl->append('lists', $list->toArray());
134
            }
135
        }
136
        $breadcrumb = array(OLEDRION_URL . 'all-lists.php' => _MI_OLEDRION_SMNAME11, OLEDRION_URL . basename(__FILE__) => _MI_OLEDRION_SMNAME10);
137
        break;
138
139
    // ************************************************************************
140
    case 'addProduct': // Ajout d'un produit à une liste *********************
141
        // ************************************************************************
142
        $xoopsTpl->assign('op', $op);
143
        $product_id = isset($_GET['product_id']) ? intval($_GET['product_id']) : 0;
144
        if ($product_id == 0) {
145
            oledrion_utils::redirect(_OLEDRION_ERROR14, $baseurl, 4);
146
        }
147
        $userListsCount = $handlers->h_oledrion_lists->getRecentListsCount(OLEDRION_LISTS_ALL, $uid);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<oledrion_handler>. 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...
148
        $xoopsTpl->assign('userListsCount', $userListsCount);
149
        $xoopsTpl->assign('product_id', $product_id);
150
        if ($userListsCount > 0) {
151
            $userLists = $handlers->h_oledrion_lists->getRecentLists(new oledrion_parameters(array('start' => 0, 'limit' => 0, 'sort' => 'list_title', 'order' => 'ASC', 'idAsKey' => true, 'listType' => OLEDRION_LISTS_ALL, 'list_uid' => $uid)));
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<oledrion_handler>. 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...
152
            foreach ($userLists as $list) {
153
                $xoopsTpl->append('lists', $list->toArray());
154
            }
155
            $breadcrumb = array(OLEDRION_URL . 'all-lists.php' => _MI_OLEDRION_SMNAME11, OLEDRION_URL . basename(__FILE__) => _MI_OLEDRION_SMNAME10, OLEDRION_URL => _OLEDRION_ADD_PRODUCT_LIST);
156
            $product = null;
157
            $product = $handlers->h_oledrion_products->get($product_id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products does not exist on object<oledrion_handler>. 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...
158 View Code Duplication
            if (is_object($product) && $product->isProductVisible()) {
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...
159
                $xoopsTpl->assign('product', $product->toArray());
160
            } else {
161
                oledrion_utils::redirect(_OLEDRION_ERROR1, $baseurl, 4);
162
            }
163
        } else {
164
            $sform = listForm('addList', $product_id);
165
            $title = _OLEDRION_ADD_LIST;
166
            $breadcrumb = array(OLEDRION_URL . 'all-lists.php' => _MI_OLEDRION_SMNAME11, OLEDRION_URL . basename(__FILE__) => _MI_OLEDRION_SMNAME10, OLEDRION_URL => $title);
167
            $xoopsTpl->assign('form', $sform->render());
168
        }
169
        break;
170
171
    // ************************************************************************
172
    case 'addProductToList': // Ajout d'un produit à une liste, sélection de la liste
173
        // ************************************************************************
174
        $xoopsTpl->assign('op', $op);
175
        $product_id = isset($_POST['product_id']) ? intval($_POST['product_id']) : 0;
176
        if ($product_id == 0) {
177
            oledrion_utils::redirect(_OLEDRION_ERROR14, $baseurl, 4);
178
        }
179
        $product = null;
180
        $product = $handlers->h_oledrion_products->get($product_id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products does not exist on object<oledrion_handler>. 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...
181 View Code Duplication
        if (is_object($product) && $product->isProductVisible()) {
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...
182
            $xoopsTpl->assign('product', $product->toArray());
183
        } else {
184
            oledrion_utils::redirect(_OLEDRION_ERROR1, $baseurl, 4);
185
        }
186
187
        $list_id = isset($_POST['list_id']) ? intval($_POST['list_id']) : 0;
188
        if ($list_id == 0) { // Ajouter à une nouvelle liste
189
            $sform = listForm('addList', $product_id);
190
            $title = _OLEDRION_ADD_LIST;
191
            $breadcrumb = array(OLEDRION_URL . 'all-lists.php' => _MI_OLEDRION_SMNAME11, OLEDRION_URL . basename(__FILE__) => _MI_OLEDRION_SMNAME10, OLEDRION_URL => $title);
192
            $xoopsTpl->assign('form', $sform->render());
193
            $xoopsTpl->assign('op', 'addList');
194
        } else { // Ajouter à une liste existante
195
            if (!$handlers->h_oledrion_lists->isThisMyList($list_id)) {
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<oledrion_handler>. 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...
196
                oledrion_utils::redirect(_OLEDRION_ERROR25, $baseurl, 8);
197
            }
198
            if ($handlers->h_oledrion_products_list->isProductAlreadyInList($list_id, $product_id)) {
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products_list does not exist on object<oledrion_handler>. 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...
199
                oledrion_utils::redirect(_OLEDRION_ERROR26, $baseurl . '?op=addProduct&product_id=' . $product_id, 4);
200
            } else {
201
                $res = $handlers->h_oledrion_products_list->addProductToUserList($list_id, $product_id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products_list does not exist on object<oledrion_handler>. 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...
202
                if ($res) {
203
                    $list = null;
204
                    $list = $handlers->h_oledrion_lists->get($list_id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<oledrion_handler>. 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...
205
                    if (is_object($list)) {
206
                        $handlers->h_oledrion_lists->incrementListProductsCount($list);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<oledrion_handler>. 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...
207
                    }
208
                    oledrion_utils::updateCache();
209
                    oledrion_utils::redirect(_OLEDRION_PRODUCT_LIST_ADD_OK, $product->getLink(), 2);
210
                } else {
211
                    oledrion_utils::redirect(_OLEDRION_ERROR27, $product->getLink(), 4);
212
                }
213
            }
214
        }
215
        break;
216
217
    // ************************************************************************
218
    case 'delete': // Suppression d'une liste ********************************
219
        // ************************************************************************
220
        $xoopsTpl->assign('op', $op);
221
        $list_id = isset($_GET['list_id']) ? intval($_GET['list_id']) : 0;
222
        if ($list_id == 0) {
223
            oledrion_utils::redirect(_OLEDRION_ERROR21, $baseurl, 4);
224
        }
225
        // Vérification, est-ce que l'utilisateur courant est bien le propriétaire de cette liste ?
226
        if (!$handlers->h_oledrion_lists->isThisMyList($list_id)) {
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<oledrion_handler>. 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...
227
            oledrion_utils::redirect(_OLEDRION_ERROR25, $baseurl, 8);
228
        }
229
        $item = $handlers->h_oledrion_lists->get($list_id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<oledrion_handler>. 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
        if (!is_object($item)) {
231
            oledrion_utils::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
232
        }
233
        xoops_confirm(array('op' => 'reallyDelete', 'list_id' => $list_id), $baseurl, _OLEDRION_DELETE_LIST . '<br />' . $item->getVar('list_title'));
234
        break;
235
236
    // ************************************************************************
237
    case 'reallyDelete': // Suppression effective d'une liste **************
238
        // ************************************************************************
239
        $list_id = isset($_POST['list_id']) ? intval($_POST['list_id']) : 0;
240
        if ($list_id == 0) {
241
            oledrion_utils::redirect(_OLEDRION_ERROR21, $baseurl, 4);
242
        }
243
        // Vérification, est-ce que l'utilisateur courant est bien le propriétaire de cette liste ?
244
        if (!$handlers->h_oledrion_lists->isThisMyList($list_id)) {
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<oledrion_handler>. 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...
245
            oledrion_utils::redirect(_OLEDRION_ERROR25, $baseurl, 8);
246
        }
247
        $item = $handlers->h_oledrion_lists->get($list_id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<oledrion_handler>. 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...
248
        if (!is_object($item)) {
249
            oledrion_utils::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
250
        }
251
        if ($handlers->h_oledrion_lists->deleteList($item)) {
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<oledrion_handler>. 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...
252
            oledrion_utils::updateCache();
253
            oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl, 2);
254
        } else {
255
            oledrion_utils::redirect(_AM_OLEDRION_SAVE_PB, $baseurl, 5);
256
        }
257
        break;
258
259
    // ************************************************************************
260
    case 'save': // Sauvegarde d'une liste *********************************
261
        // ************************************************************************
262
        $list_id = isset($_POST['list_id']) ? intval($_POST['list_id']) : 0;
263
        if (!empty($list_id)) {
264
            // Vérification, est-ce que l'utilisateur courant est bien le propriétaire de cette liste ?
265
            if (!$handlers->h_oledrion_lists->isThisMyList($list_id)) {
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<oledrion_handler>. 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...
266
                oledrion_utils::redirect(_OLEDRION_ERROR25, $baseurl, 8);
267
            }
268
            $edit = true;
269
            $item = $handlers->h_oledrion_lists->get($list_id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<oledrion_handler>. 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...
270
            if (!is_object($item)) {
271
                oledrion_utils::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
272
            }
273
            $item->unsetNew();
274
            $edit = true;
275
        } else {
276
            $item = $handlers->h_oledrion_lists->create(true);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<oledrion_handler>. 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...
277
            $edit = false;
278
        }
279
        // Contrôle sur le titre
280
        if (!isset($_POST['list_title']) || (isset($_POST['list_title']) && xoops_trim($_POST['list_title']) == '')) {
281
            oledrion_utils::redirect(_OLEDRION_ERROR24, $baseurl, 5);
282
        }
283
        $item->setVars($_POST);
284
        if (!$edit) {
285
            $item->setVar('list_date', time());
286
            $item->setVar('list_uid', $uid);
287
        }
288
        if (isset($_POST['productsList'])) {
289
            $productsDeletedCount = 0;
290
            foreach ($_POST['productsList'] as $productId) {
291
                $res = $handlers->h_oledrion_products_list->deleteProductFromList($list_id, intval($productId));
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products_list does not exist on object<oledrion_handler>. 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
                if ($res) {
293
                    $productsDeletedCount++;
294
                }
295
            }
296
            if ($productsDeletedCount > 0) {
297
                $handlers->h_oledrion_products_list->decrementListProductsCount($productsDeletedCount);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products_list does not exist on object<oledrion_handler>. 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
        $res = $handlers->h_oledrion_lists->insert($item);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<oledrion_handler>. 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...
301
        if ($res) {
302
            if (isset($_POST['product_id'])) {
303
                $product_id = intval($_POST['product_id']);
304
                if ($product_id > 0) {
305
                    $product = null;
306
                    $product = $handlers->h_oledrion_products->get($product_id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products does not exist on object<oledrion_handler>. 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...
307
                    if (is_object($product) && $product->isProductVisible()) { // On peut ajouter le produit à cette nouvelle liste
308
                        $res = $handlers->h_oledrion_products_list->addProductToUserList($item->getVar('list_id'), $product_id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products_list does not exist on object<oledrion_handler>. 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...
309
                        if ($res) { // Mise à jour du nombre de produits de la liste
310
                            $handlers->h_oledrion_lists->incrementListProductsCount($item);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<oledrion_handler>. 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...
311
                            oledrion_utils::updateCache();
312
                            oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $product->getLink(), 2);
313
                        }
314
                    }
315
                }
316
            }
317
            oledrion_utils::updateCache();
318
            oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl, 2);
319
        } else {
320
            oledrion_utils::redirect(_AM_OLEDRION_SAVE_PB, $baseurl, 5);
321
        }
322
        break;
323
324
    // ************************************************************************
325
    case 'edit': // Edition d'une liste ***************************************
326
    case 'addList': // Ajout d'une liste **************************************
327
        // ************************************************************************
328
        $xoopsTpl->assign('op', $op);
329
        $sform = listForm($op, 0);
330
        if ($op == 'edit') {
331
            $title = _OLEDRION_EDIT_LIST;
332
        } else {
333
            $title = _OLEDRION_ADD_LIST;
334
        }
335
        $breadcrumb = array(OLEDRION_URL . 'all-lists.php' => _MI_OLEDRION_SMNAME11,
336
            OLEDRION_URL . basename(__FILE__) => _MI_OLEDRION_SMNAME10,
337
            OLEDRION_URL => $title);
338
339
        $xoopsTpl->assign('form', $sform->render());
340
        break;
341
}
342
343
oledrion_utils::setCSS();
344
oledrion_utils::setLocalCSS($xoopsConfig['language']);
345
346
$xoopsTpl->assign('mod_pref', $mod_pref);
347
$xoopsTpl->assign('breadcrumb', oledrion_utils::breadcrumb($breadcrumb));
0 ignored issues
show
Bug introduced by
It seems like $breadcrumb defined by '' on line 47 can also be of type string; however, oledrion_utils::breadcrumb() does only seem to accept array, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
348
349
$title = _MI_OLEDRION_SMNAME10 . ' - ' . oledrion_utils::getModuleName();
350
oledrion_utils::setMetas($title, $title);
351
require_once XOOPS_ROOT_PATH . '/footer.php';
352