File tree 3 files changed +5
-7
lines changed
3 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -3,4 +3,5 @@ A collection of common algorithms implemented in PHP. The collection is based on
3
3
4
4
The library is in a beta state. Missing something? Create a pull request!
5
5
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
+
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ public function clear(): bool {
66
66
/**
67
67
* @param int $element
68
68
*/
69
- public function insert (int $ element ) {
69
+ public function insert (int $ element ): void {
70
70
$ length = $ this ->length ();
71
71
$ this ->heap [$ length + 1 ] = $ element ;
72
72
$ currentPosition = $ this ->length ();
Original file line number Diff line number Diff line change @@ -105,7 +105,8 @@ public function get($value) {
105
105
$ flag = 1 ;
106
106
$ flag = $ flag << $ k ;
107
107
108
- return (($ this ->array [$ i ] & $ flag ) !== 0 );
108
+ if (isset ($ this ->array [$ i ])) return (($ this ->array [$ i ] & $ flag ) !== 0 );
109
+ return false ;
109
110
}
110
111
return false ;
111
112
}
@@ -137,10 +138,6 @@ public function clear($value): bool {
137
138
return false ;
138
139
}
139
140
140
- public function printVector () {
141
- \print_r ($ this ->array );
142
- }
143
-
144
141
/**
145
142
* @param $object
146
143
* @return int
You can’t perform that action at this time.
0 commit comments