Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
7 / 7
CRAP
100.00% covered (success)
100.00%
18 / 18
Configuration
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
7 / 7
7
100.00% covered (success)
100.00%
18 / 18
 __construct( CredentialsInterface $credentials, $protocol = 'https', $domain = 'secure.payu.com', $path = 'api', $version = 'v2_1' )
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
6 / 6
 getAPIUrl()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
7 / 7
 getDomain()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getPath()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getProtocol()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getVersion()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getCredentials()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
<?php
/**
 * @author Krzysztof Gzocha <krzysztof.gzocha@xsolve.pl>
 */
namespace Team3\PayU\Configuration;
use Team3\PayU\Configuration\Credentials\CredentialsInterface;
/**
 * PayU API basic configuration
 * @package Team3\PayU\Configuration
 */
class Configuration implements ConfigurationInterface
{
    /**
     * @var string
     */
    protected $protocol;
    /**
     * @var string
     */
    protected $domain;
    /**
     * @var string
     */
    protected $path;
    /**
     * @var string
     */
    protected $version;
    /**
     * @var CredentialsInterface
     */
    protected $credentials;
    /**
     * @param CredentialsInterface $credentials
     * @param string               $protocol
     * @param string               $domain
     * @param string               $path
     * @param string               $version
     */
    public function __construct(
        CredentialsInterface $credentials,
        $protocol = 'https',
        $domain = 'secure.payu.com',
        $path = 'api',
        $version = 'v2_1'
    ) {
        $this->credentials = $credentials;
        $this->protocol = $protocol;
        $this->domain = $domain;
        $this->path = $path;
        $this->version = $version;
    }
    /**
     * @return string
     */
    public function getAPIUrl()
    {
        return sprintf(
            '%s://%s/%s/%s',
            $this->getProtocol(),
            $this->getDomain(),
            $this->getPath(),
            $this->getVersion()
        );
    }
    /**
     * @return string
     */
    public function getDomain()
    {
        return $this->domain;
    }
    /**
     * @return string
     */
    public function getPath()
    {
        return $this->path;
    }
    /**
     * @return string
     */
    public function getProtocol()
    {
        return $this->protocol;
    }
    /**
     * @return string
     */
    public function getVersion()
    {
        return $this->version;
    }
    /**
     * @return CredentialsInterface
     */
    public function getCredentials()
    {
        return $this->credentials;
    }
}