/** * Adds an entry to the directory. * * @param PelEntry the entry that will be added. * * @todo The entry will be identified with its tag, so each * directory can only contain one entry with each tag. Is this a * bug? */ function addEntry(PelEntry $e) { $this->entries[$e->getTag()] = $e; }
/** * Adds an entry to the directory. * * @param PelEntry the entry that will be added. If the entry is not * valid in this IFD (as per {@link isValidTag()}) an * {@link PelInvalidDataException} is thrown. * * @todo The entry will be identified with its tag, so each * directory can only contain one entry with each tag. Is this a * bug? */ function addEntry(PelEntry $e) { if ($this->isValidTag($e->getTag())) { $e->setIfdType($this->type); $this->entries[$e->getTag()] = $e; } else { throw new PelInvalidDataException("IFD %s cannot hold\n%s", $this->getName(), $e->__toString()); } }
/** * Set or update a given tag in this IFD. * * This methods is part of the ArrayAccess SPL interface for * overriding array access of objects, it allows you to add new * entries or replace esisting entries by doing: * * <code> * $ifd[PelTag::EXPOSURE_BIAS_VALUE] = $entry; * </code> * * Note that the actual array index passed is ignored! Instead the * {@link PelTag} from the entry is used. * * @param PelTag $tag * the offset to update. * * @param PelEntry $e * the new value. */ public function offsetSet($tag, $e) { if ($e instanceof PelEntry) { $tag = $e->getTag(); $this->entries[$tag] = $e; } else { throw new PelInvalidArgumentException('Argument "%s" must be a PelEntry.', $e); } }