Source of file Parameters.php

Size: 2,739 Bytes - Last Modified: 2019-01-09T23:35:36+01:00

/Users/sylvainraye/Sites/git/swisspost/src/Parameters.php

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
<?php
/**
 * Diglin GmbH - Switzerland
 *
 * @author      Sylvain Rayé <support at diglin.com>
 * @category    Diglin
 * @package     Swisspost
 * @copyright   Copyright (c) Diglin (http://www.diglin.com)
 */

namespace Diglin\Swisspost;

/**
 * Class Parameters
 * @package Diglin\Swisspost
 */
class Parameters
{
    protected $wsdl;
    protected $location;
    protected $login;
    protected $password;
    protected $franking_licence;
    protected $language;
    protected $debug;

    public function __construct(
        $location,
        $login,
        $password,
        $franking_licence,
        $wsdl = null,
        $language = null,
        $debug = null
    )
    {
        $this->location = $location;
        $this->login = $login;
        $this->password = $password;
        $this->franking_licence = $franking_licence;
        $this->wsdl = $wsdl ?? $this->wsdl;
        $this->language = $language ?? $this->language;
        $this->debug = $debug ?? $this->debug;
    }

    /**
     * @throws \ReflectionException
     */
    public function asArray(): array
    {
        $out = [];
        $reflection = new \ReflectionClass(self::class);

        foreach ($reflection->getProperties(\ReflectionProperty::IS_PROTECTED) as $property) {
            $out[$property->getName()] = $this->{$property->getName()};
        }

        return $out;
    }

    /**
     * @return mixed
     */
    public function getLocation(): string
    {
        return $this->location;
    }

    /**
     * @return mixed
     */
    public function getLogin(): string
    {
        return $this->login;
    }

    /**
     * @return mixed
     */
    public function getPassword(): string
    {
        return $this->password;
    }

    /**
     * @return mixed
     */
    public function getFrankingLicence(): string
    {
        return $this->franking_licence;
    }

    /**
     * @return string
     */
    public function getWsdl(): string
    {
        return $this->wsdl;
    }

    /**
     * @param string $wsdl
     * @return $this
     */
    public function setWsdl($wsdl)
    {
        $this->wsdl = $wsdl;

        return $this;
    }

    /**
     * @return mixed
     */
    public function getLanguage()
    {
        return $this->language;
    }

    /**
     * @param mixed $language
     * @return $this
     */
    public function setLanguage($language)
    {
        $this->language = $language;

        return $this;
    }

    /**
     * @return mixed
     */
    public function getDebug()
    {
        return $this->debug;
    }

    /**
     * @param mixed $debug
     * @return $this
     */
    public function setDebug($debug)
    {
        $this->debug = $debug;

        return $this;
    }
}