1 | <?php |
||
20 | class CollectionDiffService |
||
21 | { |
||
22 | /** |
||
23 | * Компоент отвечающий за подготовку хеша элемента |
||
24 | * |
||
25 | * @var HashElementBuilder |
||
26 | */ |
||
27 | private $hashElementBuilder; |
||
28 | |||
29 | /** |
||
30 | * Возвращает компоент отвечающий за подготовку хеша элемента |
||
31 | * |
||
32 | * @return HashElementBuilder |
||
33 | */ |
||
34 | public function getHashElementBuilder() |
||
41 | |||
42 | /** |
||
43 | * Устанавливает компоент отвечающий за подготовку хеша элемента |
||
44 | * |
||
45 | * @param HashElementBuilder $hashElementBuilder |
||
46 | * |
||
47 | * @return $this |
||
48 | */ |
||
49 | public function setHashElementBuilder(HashElementBuilder $hashElementBuilder) |
||
55 | |||
56 | |||
57 | /** |
||
58 | * Получение расхождения элементов меджу двумя коллекциями |
||
59 | * |
||
60 | * @param Collection $sourceCollection |
||
61 | * @param Collection $targetCollection |
||
62 | * |
||
63 | * @param $prefixPath |
||
64 | * |
||
65 | * @return mixed |
||
66 | * @throws \Nnx\FormComparator\Comparator\CollectionDiffService\Exception\RuntimeException |
||
67 | */ |
||
68 | public function buildDiff(Collection $sourceCollection, Collection $targetCollection, $prefixPath) |
||
79 | |||
80 | /** |
||
81 | * @param Collection $collection |
||
82 | * |
||
83 | * |
||
84 | * @return array |
||
85 | * @throws \Nnx\FormComparator\Comparator\CollectionDiffService\Exception\RuntimeException |
||
86 | */ |
||
87 | protected function buildHashForCollectionElements(Collection $collection) |
||
102 | |||
103 | |||
104 | } |
||
105 |
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.