Issues (2963)

includes/polling/storage/vrp.inc.php (1 issue)

1
<?php
2
/**
3
 * tegile.inc.php
4
 *
5
 * LibreNMS storage polling module for Tegile Storage
6
 *
7
 * This program is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation, either version 3 of the License, or
10
 * (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19
 *
20
 * @link       https://www.librenms.org
21
 * @copyright  2018 Ryan Finney
22
 * @author     https://github.com/theherodied/
23
 */
24
if (! is_array($storage_cache['vrp'])) {
25
    $storage_cache['vrp'] = snmpwalk_cache_oid($device, 'hwStorageEntry', null, 'HUAWEI-FLASH-MAN-MIB');
0 ignored issues
show
Are you sure the assignment to $storage_cache['vrp'] is correct as snmpwalk_cache_oid($devi...'HUAWEI-FLASH-MAN-MIB') seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
26
    d_echo($storage_cache);
27
}
28
$entry = $storage_cache['vrp'][$storage['storage_index']];
29
$storage['units'] = $storage['storage_units'];
30
$storage['size'] = $entry['hwStorageSpace'] * $storage['units'];
31
$storage['free'] = $entry['hwStorageSpaceFree'] * $storage['units'];
32
$storage['used'] = $storage['size'] - $storage['free'];
33