Merge pull request #11 from bessl/patch-2
[gitphp.git] / include / exception / UnauthorizedProjectException.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
 * Custom exception when a user tries to access a project they don't have access to
 *
 * @author Christopher Han <xiphux@gmail.com>
 * @copyright Copyright (c) 2012 Christopher Han
 * @package GitPHP
 * @subpackage Exception
 */
class GitPHP_UnauthorizedProjectException extends GitPHP_MessageException
{
        /**
         * Specified project
         *
         * @var string
         */
        public $Project;
 
        /**
         * Constructor
         *
         * @param string $project project
         * @param string $message message
         * @param int $code code
         */
        public function __construct($project, $message = '', $code = 0)
        {
                $this->Project = $project;
                if (empty($message))
                        $message = sprintf('You are not authorized to access project %1$s', $project);
                parent::__construct($message, true, 403, $code); 
        }
}
 
comments