<?php
/*
* This file is part of Sulu.
*
* (c) Sulu GmbH
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Sulu\Bundle\RedirectBundle\Entity;
use Sulu\Bundle\RedirectBundle\Model\RedirectRouteInterface;
use Sulu\Component\Persistence\Model\AuditableInterface;
use Sulu\Component\Persistence\Model\AuditableTrait;
/**
* Basic implementation of redirect-route.
*/
class RedirectRoute implements RedirectRouteInterface, AuditableInterface
{
use AuditableTrait;
/**
* @var string
*/
protected $id;
/**
* @var bool
*/
protected $enabled = true;
/**
* @var int
*/
protected $statusCode = 301;
/**
* @var string
*/
protected $source;
/**
* @var string|null
*/
protected $sourceHost;
/**
* @var string
*/
protected $target;
/**
* {@inheritdoc}
*/
public function getId()
{
return $this->id;
}
/**
* {@inheritdoc}
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* {@inheritdoc}
*/
public function isEnabled()
{
return $this->enabled;
}
/**
* {@inheritdoc}
*/
public function setEnabled($enabled)
{
$this->enabled = $enabled;
return $this;
}
/**
* {@inheritdoc}
*/
public function getStatusCode()
{
return $this->statusCode;
}
/**
* {@inheritdoc}
*/
public function setStatusCode($statusCode)
{
$this->statusCode = $statusCode;
return $this;
}
/**
* {@inheritdoc}
*/
public function getSource()
{
return $this->source;
}
/**
* {@inheritdoc}
*/
public function setSource($source)
{
$this->source = mb_strtolower('/' . ltrim($source, '/'));
return $this;
}
/**
* {@inheritdoc}
*/
public function getSourceHost()
{
return $this->sourceHost;
}
/**
* {@inheritdoc}
*/
public function setSourceHost($sourceHost)
{
$this->sourceHost = empty($sourceHost) ? null : mb_strtolower($sourceHost);
return $this;
}
/**
* {@inheritdoc}
*/
public function getTarget()
{
return $this->target;
}
/**
* {@inheritdoc}
*/
public function setTarget($target)
{
$this->target = $target;
return $this;
}
}