Index: trunk/extensions/HashTables/HashTables.php |
— | — | @@ -701,11 +701,11 @@ |
702 | 702 | * @return array|null |
703 | 703 | */ |
704 | 704 | public function getHash( $hashId ) { |
| 705 | + $hashId = trim( $hashId ); |
705 | 706 | if( $this->hashExists( $hashId ) ) { |
706 | 707 | return $this->mHashTables[ $hashId ]; |
707 | | - } else { |
708 | | - return null; |
709 | 708 | } |
| 709 | + return null; |
710 | 710 | } |
711 | 711 | |
712 | 712 | /** |
— | — | @@ -718,26 +718,28 @@ |
719 | 719 | * @param string $hashId |
720 | 720 | * @param array $hashTable |
721 | 721 | */ |
722 | | - public function setHash( $hashId, $hashTable = array() ) { |
| 722 | + public function setHash( $hashId, array $hashTable = array() ) { |
723 | 723 | $hashTable = array_map( 'trim', $hashTable ); // make it all string and trim |
724 | 724 | $this->mHashTables[ trim( $hashId ) ] = $hashTable; |
725 | 725 | } |
726 | 726 | |
727 | 727 | /** |
728 | | - * Returns a value within a hash. If key or hash doesn't exist, this will return null |
| 728 | + * Returns a value within a hash. If key or hash do not exist, this will return null |
729 | 729 | * or another predefined default. |
730 | 730 | * |
731 | 731 | * @since 0.7 |
732 | 732 | * |
733 | 733 | * @param string $hashId |
734 | 734 | * @param string $key |
735 | | - * @param mixed $default value to return in cas the value doesn't exist. null by default. |
| 735 | + * @param mixed $default value to return in case the value doesn't exist. null by default. |
736 | 736 | * |
737 | 737 | * @return string |
738 | 738 | */ |
739 | 739 | public function getHashValue( $hashId, $key, $default = null ) { |
740 | 740 | $hashId = trim( $hashId ); |
741 | | - if( $this->hashExists( $hashId ) && array_key_exists( $key, $this->mHashTables[ $hashId ] ) ) { |
| 741 | + if( $this->hashExists( $hashId ) |
| 742 | + && array_key_exists( $key, $this->mHashTables[ $hashId ] ) |
| 743 | + ) { |
742 | 744 | return $this->mHashTables[ $hashId ][ $key ]; |
743 | 745 | } else { |
744 | 746 | return $default; |
— | — | @@ -753,7 +755,7 @@ |
754 | 756 | * @param type $key |
755 | 757 | */ |
756 | 758 | public function unsetHashValue( $hashId, $key ) { |
757 | | - unset( $this->mHashTables[ $hashId ][ $key ] ); |
| 759 | + unset( $this->mHashTables[ trim( $hashId ) ][ trim( $key ) ] ); |
758 | 760 | } |
759 | 761 | |
760 | 762 | /** |