src/PoFile.php
public function removeEntry(PoEntry $entry): bool
    {
        $key = $this->createKeyFromEntry($entry);

        // try by the key first.
        if (!empty($key) && isset($this->entries[$key])) {
            if ($entry === $this->entries[$key]) {
                unset($this->entries[$key]);
                return true;
            }
        }

        // the entry can't be matched by key, so we have to loop :(
        foreach ($this->entries as $key => $value) {
            if ($entry === $value) {
                unset($this->entries[$key]);
                return true;
            }
        }

        // no match found in main entries, try the unkeyedEntries
        foreach ($this->unkeyedEntries as $key => $value) {
            if ($entry === $value) {
                unset($this->unkeyedEntries[$key]);
                return true;
            }
        }

        return false;
    }
public function removeEntry(PoEntry $entry): bool
    {
        $key = $this->createKeyFromEntry($entry);

        // try by the key first.
        if (!empty($key) && isset($this->entries[$key])) {
            if ($entry === $this->entries[$key]) {
                unset($this->entries[$key]);
                return true;
            }
        }

        // the entry can't be matched by key, so we have to loop :(
        foreach ($this->entries as $key => $value) {
            if ($entry === $value) {
                unset($this->entries[$key]);
                return true;
            }
        }

        // no match found in main entries, try the unkeyedEntries
        foreach ($this->unkeyedEntries as $key => $value) {
            if ($entry === $value) {
                unset($this->unkeyedEntries[$key]);
                return true;
            }
        }

        return false;
    }
public function removeEntry ( PoEntry $ entry ) : bool { $ key = $ this -> createKeyFromEntry ( $ entry ) ; // try by the key first. if ( ! empty ( $ key ) && isset ( $ this -> entries [ $ key ] ) ) { if ( $ entry === $ this -> entries [ $ key ] ) { unset ( $ this -> entries [ $ key ] ) ; return true ; } } // the entry can't be matched by key, so we have to loop :( foreach ( $ this -> entries as $ key => $ value ) { if ( $ entry === $ value ) { unset ( $ this -> entries [ $ key ] ) ; return true ; } } // no match found in main entries, try the unkeyedEntries foreach ( $ this -> unkeyedEntries as $ key => $ value ) { if ( $ entry === $ value ) { unset ( $ this -> unkeyedEntries [ $ key ] ) ; return true ; } } return false ; }
Remove an entry from the PoFile

In simple cases, the entry can be found by key. There are several cases
where it is not that easy to locate the PoEntry to be removed:
- the PoEntry was altered, making the generated and stored key different
- the entry is not keyed and is in unkeyedEntries

In any of these cases, we must loop thru the entry arrays looking for an
exact object match, so the cost of the remove goes up

@param PoEntry $entry the PoEntry to merge

@return boolean true if remove, false if not
Remove an entry from the PoFile