public function getId($forceGeneration = true) { if ($this->realFile === null) { throw new EyeUnsupportedOperationException(__METHOD__ . ' on ' . $this->path); } $meta = $this->getMeta(); $id = null; if ($meta !== null) { $id = $meta->get(self::METADATA_KEY_ID); } if ($id === null && $forceGeneration) { $id = ObjectIdGenerator::assignId($this); } return $id; }
/** * Gets the ID and automatically generates one if it has none. * * @return string */ public final function getId($forceGeneration = true) { if ($this->id === null && $forceGeneration) { ObjectIdGenerator::assignId($this); } return $this->id; }
public function getId($forceGeneration = true) { $meta = $this->getMeta(); $id = null; if ($meta !== null) { $id = $meta->get(self::METADATA_KEY_ID); } if ($id === null && $forceGeneration) { $id = ObjectIdGenerator::assignId($this); } return $id; }