Art4\JsonApiClient\Utils\DataContainer::parseKey PHP Method

parseKey() protected method

Parse a dot.notated.key to an object
protected parseKey ( string | AccessKey $key ) : AccessKey
$key string | AccessKey The key
return AccessKey The parsed key
    protected function parseKey($key)
    {
        if (is_object($key) and $key instanceof AccessKey) {
            return $key;
        }
        // Handle arrays and objects
        if (is_object($key) or is_array($key)) {
            $key = '';
        }
        $key_string = strval($key);
        $key = new AccessKey();
        $key->raw = $key_string;
        $keys = explode('.', $key_string);
        foreach ($keys as $value) {
            $key->push($value);
        }
        $key->rewind();
        return $key;
    }