PickSearchModel::hasTeam()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 2
eloc 1
nc 2
nop 0
1
<?php
2
3
namespace PhpDraft\Domain\Models;
4
5
class PickSearchModel {
6
  /** @var string */
7
  public $draft_id;
8
9
  /** @var string */
10
  public $keywords;
11
12
  /** @var string Three-char abbreviation */
13
  public $team;
14
15
  /** @var string Three-char abbreviation */
16
  public $position;
17
18
  /** @var string Sorting by player pick, ASC or DESC */
19
  public $sort;
20
21
  /** @var array */
22
  public $player_results;
23
24
  public function __construct($draft_id, $keywords, $team, $position, $sort) {
25
    $this->draft_id = $draft_id;
26
    $this->keywords = $keywords;
27
    $this->team = $team;
28
    $this->position = $position;
29
    $this->sort = $sort;
30
  }
31
32
  /**
33
   * Used if the strict search returns no results, empty the results (for any reason) and set the count to zero.
34
   */
35
  public function emptyResultsData() {
36
    unset($this->player_results);
37
    $this->search_count = 0;
0 ignored issues
show
Bug Best Practice introduced by
The property search_count does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
38
  }
39
40
  public function hasName() {
41
    return isset($this->keywords) && strlen($this->keywords) > 0;
42
  }
43
44
  public function hasTeam() {
45
    return isset($this->team) && strlen($this->team) > 0;
46
  }
47
48
  public function hasPosition() {
49
    return isset($this->position) && strlen($this->position) > 0;
50
  }
51
52
  public function searchCount() {
53
    return count($player_results);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $player_results seems to be never defined.
Loading history...
54
  }
55
}
56