Issues (2963)

includes/polling/storage/freenas-dataset.inc.php (1 issue)

1
<?php
2
3
if (! is_array($storage_cache['dataset'])) {
4
    $storage_cache['dataset'] = snmpwalk_cache_oid($device, 'datasetTable', null, 'FREENAS-MIB');
0 ignored issues
show
Are you sure the assignment to $storage_cache['dataset'] is correct as snmpwalk_cache_oid($devi...', null, 'FREENAS-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...
5
    d_echo($storage_cache);
6
}
7
8
$entry = $storage_cache['dataset'][$storage['storage_index']];
9
10
$storage['units'] = $entry['datasetAllocationUnits'];
11
$storage['size'] = ($entry['datasetSize'] * $storage['units']);
12
$storage['free'] = ($entry['datasetAvailable'] * $storage['units']);
13
$storage['used'] = ($storage['size'] - $storage['free']);
14