@@ 727-737 (lines=11) @@ | ||
724 | * @param int $textId |
|
725 | * @return bool |
|
726 | */ |
|
727 | function addItem( $text, $textId ) { |
|
728 | if ( !$this->cgz ) { |
|
729 | $class = $this->blobClass; |
|
730 | $this->cgz = new $class; |
|
731 | } |
|
732 | $hash = $this->cgz->addItem( $text ); |
|
733 | $this->referrers[$textId] = $hash; |
|
734 | $this->texts[$textId] = $text; |
|
735 | ||
736 | return $this->cgz->isHappy(); |
|
737 | } |
|
738 | ||
739 | function getSize() { |
|
740 | return count( $this->texts ); |
|
@@ 746-754 (lines=9) @@ | ||
743 | /** |
|
744 | * Recompress text after some aberrant modification |
|
745 | */ |
|
746 | function recompress() { |
|
747 | $class = $this->blobClass; |
|
748 | $this->cgz = new $class; |
|
749 | $this->referrers = []; |
|
750 | foreach ( $this->texts as $textId => $text ) { |
|
751 | $hash = $this->cgz->addItem( $text ); |
|
752 | $this->referrers[$textId] = $hash; |
|
753 | } |
|
754 | } |
|
755 | ||
756 | /** |
|
757 | * Commit the blob. |