1<?php
2/**
3 * File containing the ezcPropertyReadOnlyException class
4 *
5 * @package Base
6 * @version 1.8
7 * @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
8 * @license http://ez.no/licenses/new_bsd New BSD License
9 */
10/**
11 * ezcBasePropertyPermissionException is thrown whenever a read-only property
12 * is tried to be changed, or when a write-only property was accessed for reading.
13 *
14 * @package Base
15 * @version 1.8
16 */
17class ezcBasePropertyPermissionException extends ezcBaseException
18{
19    /**
20     * Used when the property is read-only.
21     */
22    const READ  = 1;
23
24    /**
25     * Used when the property is write-only.
26     */
27    const WRITE = 2;
28
29    /**
30     * Constructs a new ezcPropertyPermissionException for the property $name.
31     *
32     * @param string $name The name of the property.
33     * @param int    $mode The mode of the property that is allowed (::READ or ::WRITE).
34     */
35    function __construct( $name, $mode )
36    {
37        parent::__construct( "The property '{$name}' is " .
38            ( $mode == self::READ ? "read" : "write" ) .
39            "-only." );
40    }
41}
42?>
43