1 | <?php namespace Anomaly\PreferencesModule\Preference; |
||
18 | class PreferenceRepository extends EntryRepository implements PreferenceRepositoryInterface |
||
19 | { |
||
20 | |||
21 | /** |
||
22 | * The authentication guard. |
||
23 | * |
||
24 | * @var Guard |
||
25 | */ |
||
26 | protected $auth; |
||
27 | |||
28 | /** |
||
29 | * The preference model. |
||
30 | * |
||
31 | * @var PreferenceModel |
||
32 | */ |
||
33 | protected $model; |
||
34 | |||
35 | /** |
||
36 | * The preferences collection. |
||
37 | * |
||
38 | * @var PreferenceCollection |
||
39 | */ |
||
40 | protected $preferences; |
||
41 | |||
42 | /** |
||
43 | * Create a new PreferenceRepositoryInterface instance. |
||
44 | * |
||
45 | * @param Guard $auth |
||
46 | * @param PreferenceModel $model |
||
47 | */ |
||
48 | public function __construct(Guard $auth, PreferenceModel $model) |
||
59 | |||
60 | /** |
||
61 | * Return if a preference exists or not. |
||
62 | * |
||
63 | * @param $key |
||
64 | * @return bool |
||
65 | */ |
||
66 | public function has($key) |
||
70 | |||
71 | /** |
||
72 | * Get a preference. |
||
73 | * |
||
74 | * @param $key |
||
75 | * @return null|PreferenceInterface |
||
76 | */ |
||
77 | public function get($key) |
||
81 | |||
82 | /** |
||
83 | * Set a preferences value. |
||
84 | * |
||
85 | * @param $key |
||
86 | * @param $value |
||
87 | * @return bool |
||
88 | */ |
||
89 | public function set($key, $value) |
||
102 | |||
103 | /** |
||
104 | * Get a preference value presenter instance. |
||
105 | * |
||
106 | * @param $key |
||
107 | * @param null $default |
||
108 | * @return FieldTypePresenter|null |
||
109 | */ |
||
110 | public function value($key, $default = null) |
||
118 | |||
119 | /** |
||
120 | * Find a preference by it's key |
||
121 | * or return a new instance. |
||
122 | * |
||
123 | * @param $key |
||
124 | * @return PreferenceInterface |
||
125 | */ |
||
126 | public function findByKeyOrNew($key) |
||
143 | |||
144 | /** |
||
145 | * Find all preferences with namespace. |
||
146 | * |
||
147 | * @param $namespace |
||
148 | * @return PreferenceCollection |
||
149 | */ |
||
150 | public function findAllByNamespace($namespace) |
||
154 | } |
||
155 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
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.