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

        // some entires, such as obsolete entries, have no key
        // for some uses, these are dead weight - need better strategy for that case
        if (empty($key)) {
            $this->unkeyedEntries[] = $entry;
            return true;
        }

        if (isset($this->entries[$key]) && !$replace) {
            return false;
        } else {
            $this->entries[$key] = $entry;
            return true;
        }
    }
public function addEntry(PoEntry $entry, bool $replace = true): bool
    {
        $key = $this->createKeyFromEntry($entry);

        // some entires, such as obsolete entries, have no key
        // for some uses, these are dead weight - need better strategy for that case
        if (empty($key)) {
            $this->unkeyedEntries[] = $entry;
            return true;
        }

        if (isset($this->entries[$key]) && !$replace) {
            return false;
        } else {
            $this->entries[$key] = $entry;
            return true;
        }
    }
public function addEntry ( PoEntry $ entry , bool $ replace = true ) : bool { $ key = $ this -> createKeyFromEntry ( $ entry ) ; // some entires, such as obsolete entries, have no key // for some uses, these are dead weight - need better strategy for that case if ( empty ( $ key ) ) { $ this -> unkeyedEntries [ ] = $ entry ; return true ; } if ( isset ( $ this -> entries [ $ key ] ) && ! $ replace ) { return false ; } else { $ this -> entries [ $ key ] = $ entry ; return true ; } }
Add an entry to the PoFile using internal key

@param PoEntry $entry   the PoEntry to add
@param boolean $replace true to replace any existing entry matching this key,
false to not change the PoFile for a duplicated key

@return boolean true if added, false if not
Add an entry to the PoFile using internal key