2016-08-07 15:44:33 +03:00
|
|
|
<?php
|
2017-10-12 11:13:20 +03:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2016-08-07 15:44:33 +03:00
|
|
|
namespace Shlinkio\Shlink\Core\Options;
|
|
|
|
|
|
|
|
use Shlinkio\Shlink\Common\Util\StringUtilsTrait;
|
|
|
|
use Zend\Stdlib\AbstractOptions;
|
2018-10-28 10:34:02 +03:00
|
|
|
use function sprintf;
|
2016-08-07 15:44:33 +03:00
|
|
|
|
|
|
|
class AppOptions extends AbstractOptions
|
|
|
|
{
|
|
|
|
use StringUtilsTrait;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $name = '';
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $version = '1.0';
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $secretKey = '';
|
2018-01-14 11:13:49 +03:00
|
|
|
/**
|
|
|
|
* @var string|null
|
|
|
|
*/
|
|
|
|
protected $disableTrackParam;
|
2016-08-07 15:44:33 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* AppOptions constructor.
|
|
|
|
* @param array|null|\Traversable $options
|
|
|
|
*/
|
|
|
|
public function __construct($options = null)
|
|
|
|
{
|
|
|
|
parent::__construct($options);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getName()
|
|
|
|
{
|
|
|
|
return $this->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $name
|
|
|
|
* @return $this
|
|
|
|
*/
|
|
|
|
protected function setName($name)
|
|
|
|
{
|
|
|
|
$this->name = $name;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getVersion()
|
|
|
|
{
|
|
|
|
return $this->version;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $version
|
|
|
|
* @return $this
|
|
|
|
*/
|
|
|
|
protected function setVersion($version)
|
|
|
|
{
|
|
|
|
$this->version = $version;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function getSecretKey()
|
|
|
|
{
|
|
|
|
return $this->secretKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param mixed $secretKey
|
|
|
|
* @return $this
|
|
|
|
*/
|
|
|
|
protected function setSecretKey($secretKey)
|
|
|
|
{
|
|
|
|
$this->secretKey = $secretKey;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2018-01-14 11:13:49 +03:00
|
|
|
/**
|
|
|
|
* @return string|null
|
|
|
|
*/
|
|
|
|
public function getDisableTrackParam()
|
|
|
|
{
|
|
|
|
return $this->disableTrackParam;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string|null $disableTrackParam
|
|
|
|
* @return $this|self
|
|
|
|
*/
|
|
|
|
protected function setDisableTrackParam($disableTrackParam): self
|
|
|
|
{
|
|
|
|
$this->disableTrackParam = $disableTrackParam;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2016-08-07 15:44:33 +03:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function __toString()
|
|
|
|
{
|
|
|
|
return sprintf('%s:v%s', $this->name, $this->version);
|
|
|
|
}
|
|
|
|
}
|