private function getExtra(
        RootPackageInterface $root, PluginState $state, $extra
    ) {
        $rootExtra   = $root->getExtra();

        if ($state->replaceDuplicateLinks()) {
            return self::mergeExtraArray($state->shouldMergeExtraDeep(), $rootExtra, $extra);
        }

        if ( ! $state->shouldMergeExtraDeep()) {
            foreach (array_intersect(array_keys($extra), array_keys($rootExtra)) as $key) {
                $this->getLogger()->info(
                    "Ignoring duplicate <comment>{$key}</comment> in ".
                    "<comment>{$this->getPath()}</comment> extra config."
                );
            }
        }

        return static::mergeExtraArray($state->shouldMergeExtraDeep(), $extra, $rootExtra);
    }