Issues (994)

src/Office/user.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Office;
4
5
class user extends \User\user
6
{
7
  /**
8
   * PDO instance.
9
   *
10
   * @var \DB\pdo
11
   */
12
  private $pdo;
13
  /**
14
   * User meta instance.
15
   *
16
   * @var \User\meta
17
   */
18
  public $usermeta;
19
20
  public function __construct(\DB\pdo $pdo)
21
  {
22
    $this->pdo = $pdo;
23
    $this->pdo_instance($pdo);
24
    $this->usermeta = new \User\meta($pdo);
25
  }
26
27
  /**
28
   * Get office list of current logged in user.
29
   *
30
   * @requires `\User\user::is_login` check login before doing this
31
   *
32
   * @return array
33
   */
34
  public function getOffices()
35
  {
36
    $meta = $this->usermeta->get($this->userdata('id'), 'office');
0 ignored issues
show
Are you sure the assignment to $meta is correct as $this->usermeta->get($th...erdata('id'), 'office') targeting User\meta::get() 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...
37
    if (isset($meta['value'])) {
38
      return $meta['value'];
39
    }
40
    return [];
41
  }
42
}
43