Get the mapped key index of a mappedKey

@param $mappedKey
@param $key
@return bool|string
768685
protected function getMappedKeyIndex($mappedKey, $key)
    {
        $startSize = strlen($this->getStartMapDelimiter()) - 1;
        $key = substr($key, $startSize, strrpos($key, $this->getEndMapDelimiter())-$startSize);
        return substr($mappedKey, strlen($key . self::MAPPED_KEY_SEPARATOR));
    }
245096
public function get($key)
    {
        if (!$this->offsetExists($key)) {
            throw new InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $key));
        }
        return $this->offsetGet($key);
    }
1041503
private function _getSecondaryKeys($data, $key = null)
    {
        if ($key) {
            $data = ArrayHelper::getValue($data, $key, []);
        }

        return ArrayHelper::getColumn($data, $this->relSecondaryKey);
    }
12555
public static function getCoordinateMap($key=NULL)
    {
        if ($key) {
            return isset(self::$_keyCoordinateMap[$key]) ? self::$_keyCoordinateMap[$key] : NULL;
        } else {
            return self::$_keyCoordinateMap;
        }
    }
376063
public function offsetGet( $key )
    {
        $key = strtolower( $key );
        if ( !array_key_exists( $key, $this->lookup ) )
        {
            return null;
        }
        return $this->map[$this->lookup[$key]];
    }
443033
public function getIndexMap(string $indexKey = null)
    {
        if (null === $indexKey) {
            return $this->getEntries();
        }

        // Get storage keys for the objects.
        $index = [];
        foreach ($this->getEntries() as $key => $value) {
            $index[$key] = $value[$indexKey] ?? null;
        }

        return $index;
    }
877411
protected function get_index_from_key($key) {
        if (isset(self::$lockidcache[$key])) {
            return self::$lockidcache[$key];
        }

        $index = 0;
        $record = $this->db->get_record('lock_db', array('resourcekey' => $key));
        if ($record) {
            $index = $record->id;
        }

        if (!$index) {
            $record = new \stdClass();
            $record->resourcekey = $key;
            try {
                $index = $this->db->insert_record('lock_db', $record);
            } catch (\dml_exception $de) {
                // Race condition - never mind - now the value is guaranteed to exist.
                $record = $this->db->get_record('lock_db', array('resourcekey' => $key));
                if ($record) {
                    $index = $record->id;
                }
            }
        }

        if (!$index) {
            throw new \moodle_exception('Could not generate unique index for key');
        }

        self::$lockidcache[$key] = $index;
        return $index;
    }
312209
public static function getRangeMap($key=NULL)
    {
        if ($key) {
            return isset(self::$_keyRangeMap[$key]) ? self::$_keyRangeMap[$key] : NULL;
        } else {
            return self::$_keyRangeMap;
        }
    }
1018365
private function __key($key)
    {
        if ($key instanceof AnObjectHandlable) {
            $key = $key->getHandle();
        } elseif (gettype($key) == 'object') {
            $key = spl_object_hash($key);
        }

        return $key;
    }
484087
public function offsetGet($key)
    {
        if (!isset($this->components[$key])) {
            throw new \LogicException("The requested key [$key] does not exist.");
        }

        return $this->components[$key];
    }
722205
public function decr($key)
    {
        if ($this->isMappedKey($key)) {
            return false;
        }
        return $this->getDriver()->decr($key);
    }
208374
public function getQueryMapping($schemaKey = 'default')
    {
        if (isset($this->responseCache[$schemaKey])) {
            return $this->responseCache[$schemaKey];
        }

        /** @noinspection PhpUndefinedFieldInspection */
        /** @noinspection StaticInvocationViaThisInspection */
        $urlWithKey = $this->getSchemaMapping();
        if (!isset($urlWithKey[$schemaKey])) {
            return [];
        }

        $url = trim($urlWithKey[$schemaKey]);
        $map = null;
        try {
            $contents = $this->getClient()->getURL($url, $this->config()->get('timeout'));
            $map = json_decode($contents, true);
        } catch (Exception $e) {
            user_error($e->getMessage(), E_USER_WARNING);
            $map = [];
        }
        if (!is_array($map)) {
            $map = [];
        }

        $this->responseCache[$schemaKey] = $map;

        return $map;
    }
1332085
private function getKey ( $key = NULL ) {
        if ($key === NULL) {
            $key = $this->__keyName;
            return $this->getClassKey() . '_' . $this->$key;
        }
        return $this->getClassKey() . '_' . $key;
    }
1364128
private static function getNumericKeyValue($key)
    {
        $newKey = \str_replace('np_serializer_element_', '', $key);
        list($type, $index) = \explode('_', $newKey);

        if ('integer' === $type) {
            $index = (int) $index;
        }

        return $index;
    }
334902
public function getBy(string $indexId, string $key)
    {
        if (!isset($this->indexes[$indexId])) {
            throw new InvalidMapIndex($indexId);
        }

        return $this->get($this->indexes[$indexId]->get($key));
    }
834532
protected function getKeys(array $entities, $key = null)
    {
        if (is_null($key)) {
            $key = $this->relatedMap->getKeyName();
        }

        $host = $this;

        return array_unique(array_values(array_map(function ($value) use ($key, $host) {
            if (!$value instanceof InternallyMappable) {
                $value = $host->factory->make($value);
            }

            return $value->getEntityAttribute($key);
        }, $entities)));
    }
610987
public function getIndexingProperty($key)
    {
        $this->loadIndexingProperties();

        if (!array_key_exists($key, $this->indexingProperties)) {
            throw new \InvalidArgumentException(
                'No indexing property "' . $key . '".',
                1323174143
            );
        }

        return $this->indexingProperties[$key];
    }