public static function build($passwordHasher)
    {
        $config = [];
        if (is_string($passwordHasher)) {
            $class = $passwordHasher;
        } else {
            $class = $passwordHasher['className'];
            $config = $passwordHasher;
            unset($config['className']);
        }

        $className = App::className($class, 'PasswordHasher', 'PasswordHasher');
        if ($className === false) {
            throw new RuntimeException(sprintf('Password hasher class `%s` was not found.', $class));
        }

        $hasher = new $className($config);
        if (!($hasher instanceof PasswordHasherInterface)) {
            throw new RuntimeException('Password hasher must implement PasswordHasherInterface.');
        }

        return $hasher;
    }