Skip to content

Commit b017d7b

Browse files
committed
minor bug fixes
1 parent 457641d commit b017d7b

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ A collection of common algorithms implemented in PHP. The collection is based on
33

44
The library is in a beta state. Missing something? Create a pull request!
55

6-
You can find the package on Packagist: https://packagist.org/packages/doganoo/php-algorithms
6+
You can find the package on Packagist: https://packagist.org/packages/doganoo/php-algorithms
7+

src/Datastructure/Graph/Tree/Heap/MinHeap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function clear(): bool {
6666
/**
6767
* @param int $element
6868
*/
69-
public function insert(int $element) {
69+
public function insert(int $element): void {
7070
$length = $this->length();
7171
$this->heap[$length + 1] = $element;
7272
$currentPosition = $this->length();

src/Datastructure/Maps/IntegerVector.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ public function get($value) {
105105
$flag = 1;
106106
$flag = $flag << $k;
107107

108-
return (($this->array[$i] & $flag) !== 0);
108+
if (isset($this->array[$i])) return (($this->array[$i] & $flag) !== 0);
109+
return false;
109110
}
110111
return false;
111112
}
@@ -137,10 +138,6 @@ public function clear($value): bool {
137138
return false;
138139
}
139140

140-
public function printVector() {
141-
\print_r($this->array);
142-
}
143-
144141
/**
145142
* @param $object
146143
* @return int

0 commit comments

Comments
 (0)