File tree Expand file tree Collapse file tree 3 files changed +5
-7
lines changed Expand file tree Collapse file tree 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
33
44The 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+
Original file line number Diff line number Diff 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 ();
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments