<commit_before><?php
/**
 * Site redirects
 *
 * This object contains a list of urls to redirect. For use with the content
 * management system.
 *
 * PHP version 5.3
 *
 * LICENSE: No License yet
 *
 * @category  Reliv
 * @package   Rcm
 * @author    <NAME> <<EMAIL>>
 * @copyright 2012 Reliv International
 * @license   License.txt New BSD License
 * @version   GIT: <git_id>
 * @link      http://github.com/reliv
 */
namespace Rcm\Entity;

use Doctrine\ORM\Mapping as ORM;
use Rcm\Exception\InvalidArgumentException;
use Reliv\RcmApiLib\Model\AbstractApiModel;
use Zend\Validator\Uri;
use Zend\Validator\ValidatorInterface;

/**
 * Site redirects
 *
 * This object contains a list of urls to redirect. For use with the content
 * management system.
 *
 * @category  Reliv
 * @package   Rcm
 * @author    <NAME> <<EMAIL>>
 * @copyright 2012 Reliv International
 * @license   License.txt New BSD License
 * @version   Release: 1.0
 * @link      http://github.com/reliv
 *
 * @ORM\Entity (repositoryClass="Rcm\Repository\Redirect")
 * @ORM\Table(name="rcm_redirects",
 *     indexes={
 *         @ORM\Index(name="redirect_request_url", columns={"requestUrl"})
 *     }
 * )
 */
class Redirect extends AbstractApiModel
{
    /**
     * @var int Auto-Incremented Primary Key
     *
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue
     */
    protected $redirectId;

    /**
     * @var string Request URL
     *
     * @ORM\Column(type="string")
     */
    protected $requestUrl;

    /**
     * @var string Redirect URL
     *
     * @ORM\Column(type="string")
     */
    protected $redirectUrl;

    /**
     * @var \Rcm\Entity\Site
     *
     * @ORM\ManyToOne(targetEntity="Site")
     * @ORM\JoinColumn(
     *     name="siteId",
     *     referencedColumnName="siteId",
     *     onDelete="CASCADE"
     * )
     **/
    protected $site;

    /**
     * @var int|null $siteId
     *
     * @ORM\Column(type="integer")
     */
    protected $siteId = null;


    protected function getUrlValidator()
    {
        return new Uri();

    }
    /**
     * @return int|null
     */
    public function getSiteId()
    {
        return $this->siteId;
    }

    /**
     * Set the Redirect Id.  This was added for unit testing and
     * should not be used by calling scripts.  Instead please persist the object
     * with Doctrine and allow Doctrine to set this on it's own.
     *
     * @param int $redirectId Redirect ID
     *
     * @return void
     */
    public function setRedirectId($redirectId)
    {
        $this->redirectId = $redirectId;
    }

    /**
     * Get the Redirect Id
     *
     * @return int
     */
    public function getRedirectId()
    {
        return $this->redirectId;
    }

    /**
     * Set the Redirect URL
     *
     * @param string $redirectUrl Redirect URL
     *
     * @return void
     * @throws InvalidArgumentException
     */
    public function setRedirectUrl($redirectUrl)
    {

        if (!$this->getUrlValidator()->isValid($redirectUrl)) {
            throw new InvalidArgumentException('URL provided is invalid');
        }

        $this->redirectUrl = $redirectUrl;
    }

    /**
     * Get Redirect URL
     *
     * @return string
     */
    public function getRedirectUrl()
    {
        return $this->redirectUrl;
    }

    /**
     * Set the Request URL to redirect
     *
     * @param string $requestUrl Request URL to redirect
     *
     * @return void
     * @throws \Exception
     */
    public function setRequestUrl($requestUrl)
    {
        if (!$this->urlValidator->isValid($requestUrl)) {<commit_msg>redirect changes<commit_after><?php
/**
 * Site redirects
 *
 * This object contains a list of urls to redirect. For use with the content
 * management system.
 *
 * PHP version 5.3
 *
 * LICENSE: No License yet
 *
 * @category  Reliv
 * @package   Rcm
 * @author    <NAME> <<EMAIL>>
 * @copyright 2012 Reliv International
 * @license   License.txt New BSD License
 * @version   GIT: <git_id>
 * @link      http://github.com/reliv
 */
namespace Rcm\Entity;

use Doctrine\ORM\Mapping as ORM;
use Rcm\Exception\InvalidArgumentException;
use Reliv\RcmApiLib\Model\AbstractApiModel;
use Zend\Validator\Uri;
use Zend\Validator\ValidatorInterface;

/**
 * Site redirects
 *
 * This object contains a list of urls to redirect. For use with the content
 * management system.
 *
 * @category  Reliv
 * @package   Rcm
 * @author    <NAME> <<EMAIL>>
 * @copyright 2012 Reliv International
 * @license   License.txt New BSD License
 * @version   Release: 1.0
 * @link      http://github.com/reliv
 *
 * @ORM\Entity (repositoryClass="Rcm\Repository\Redirect")
 * @ORM\Table(name="rcm_redirects",
 *     indexes={
 *         @ORM\Index(name="redirect_request_url", columns={"requestUrl"})
 *     }
 * )
 */
class Redirect extends AbstractApiModel
{
    /**
     * @var int Auto-Incremented Primary Key
     *
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue
     */
    protected $redirectId;

    /**
     * @var string Request URL
     *
     * @ORM\Column(type="string")
     */
    protected $requestUrl;

    /**
     * @var string Redirect URL
     *
     * @ORM\Column(type="string")
     */
    protected $redirectUrl;

    /**
     * @var \Rcm\Entity\Site
     *
     * @ORM\ManyToOne(targetEntity="Site")
     * @ORM\JoinColumn(
     *     name="siteId",
     *     referencedColumnName="siteId",
     *     onDelete="CASCADE"
     * )
     **/
    protected $site;

    /**
     * @var int|null $siteId
     *
     * @ORM\Column(type="integer")
     */
    protected $siteId = null;


    protected function getUrlValidator()
    {
        return new Uri();

    }
    /**
     * @return int|null
     */
    public function getSiteId()
    {
        return $this->siteId;
    }

    /**
     * Set the Redirect Id.  This was added for unit testing and
     * should not be used by calling scripts.  Instead please persist the object
     * with Doctrine and allow Doctrine to set this on it's own.
     *
     * @param int $redirectId Redirect ID
     *
     * @return void
     */
    public function setRedirectId($redirectId)
    {
        $this->redirectId = $redirectId;
    }

    /**
     * Get the Redirect Id
     *
     * @return int
     */
    public function getRedirectId()
    {
        return $this->redirectId;
    }

    /**
     * Set the Redirect URL
     *
     * @param string $redirectUrl Redirect URL
     *
     * @return void
     * @throws InvalidArgumentException
     */
    public function setRedirectUrl($redirectUrl)
    {

        if (!$this->getUrlValidator()->isValid($redirectUrl)) {
            throw new InvalidArgumentException('URL provided is invalid');
        }

        $this->redirectUrl = $redirectUrl;
    }

    /**
     * Get Redirect URL
     *
     * @return string
     */
    public function getRedirectUrl()
    {
        return $this->redirectUrl;
    }

    /**
     * Set the Request URL to redirect
     *
     * @param string $requestUrl Request URL to redirect
     *
     * @return void
     * @throws \Exception
     */
    public function setRequestUrl($requestUrl)
    {
        if (!$this->getUrlValidator()->isValid($requestUrl)) {
{'fraction_non_alphanumeric': 0.1218568665377176, 'fraction_numerical': 0.0033158331030671458, 'mean_word_length': 2.2030973451327434, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3065243', 'n_tokens_mistral': 2229, 'n_tokens_neox': 2168, 'n_words': 557}