/** * Retrieve or insert a value in the index. * * @param string $idx name of the index * @param string $suffix subpart identifier * @param string $value line to find in the index * @return int|bool line number of the value in the index or false if writing the index failed * @author Tom N Harris <*****@*****.**> */ protected function addIndexKey($idx, $suffix, $value) { $key = $idx . $suffix; if (isset($this->indexes[$key]) === false) { $this->indexes[$key] = parent::getIndex($idx, $suffix); } $id = array_search($value, $this->indexes[$key], true); if ($id === false) { $id = count($this->indexes[$key]); $this->indexes[$key][$id] = $value; if (isset($this->indexesToFlush[$key]) === false) { $this->indexesToFlush[$key] = array($idx, $suffix); } } return $id; }