xabbuh/panda-client

View on GitHub
src/Api/AccountManagerInterface.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

/*
 * This file is part of the XabbuhPandaClient package.
 *
 * (c) Christian Flothmann <christian.flothmann@xabbuh.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Xabbuh\PandaClient\Api;

/**
 * Interface definition for account manager implementations.
 *
 * @author Christian Flothmann <christian.flothmann@xabbuh.de>
 */
interface AccountManagerInterface
{
    /**
     * Register an Account on this manager.
     *
     * @param string  $key     Map this key to the Account being registered
     * @param Account $account Account to register
     */
    public function registerAccount($key, Account $account);

    /**
     * Tests whether an Account is registered.
     *
     * @param string $key The key to check for
     *
     * @return bool True if an Account is registered with the given key,
     *              false otherwise
     */
    public function hasAccount($key);

    /**
     * Returns the Account for a key.
     *
     * @param string $key The internal key, returns the default Account if
     *                    null is given
     *
     * @return Account The requested Account
     *
     * @throws \InvalidArgumentException if no account for the given key exists
     */
    public function getAccount($key = null);

    /**
     * Changes the key for the default account.
     *
     * @param string $key The new default key
     */
    public function setDefaultAccount($key);

    /**
     * Returns the application's default account.
     *
     * @return Account The default account
     */
    public function getDefaultAccount();
}