Namespaces

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
      • Adapters
      • Extensions
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Diagnostics
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
      • PhpGenerator
  • NetteModule
  • None
  • PHP

Classes

  • ArrayHash
  • ArrayList
  • Callback
  • DateTime
  • Framework
  • FreezableObject
  • Image
  • Object
  • ObjectMixin

Interfaces

  • IFreezable

Exceptions

  • ArgumentOutOfRangeException
  • DeprecatedException
  • DirectoryNotFoundException
  • FatalErrorException
  • FileNotFoundException
  • InvalidArgumentException
  • InvalidStateException
  • IOException
  • MemberAccessException
  • NotImplementedException
  • NotSupportedException
  • OutOfRangeException
  • StaticClassException
  • UnexpectedValueException
  • UnknownImageFileException
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (http://nette.org)
 5:  *
 6:  * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
 7:  *
 8:  * For the full copyright and license information, please view
 9:  * the file license.txt that was distributed with this source code.
10:  */
11: 
12: namespace Nette;
13: 
14: use Nette;
15: 
16: 
17: 
18: /**
19:  * Defines an object that has a modifiable and a read-only (frozen) state.
20:  *
21:  * @author     David Grudl
22:  *
23:  * @property-read bool $frozen
24:  */
25: abstract class FreezableObject extends Object implements IFreezable
26: {
27:     /** @var bool */
28:     private $frozen = FALSE;
29: 
30: 
31: 
32:     /**
33:      * Makes the object unmodifiable.
34:      * @return void
35:      */
36:     public function freeze()
37:     {
38:         $this->frozen = TRUE;
39:     }
40: 
41: 
42: 
43:     /**
44:      * Is the object unmodifiable?
45:      * @return bool
46:      */
47:     final public function isFrozen()
48:     {
49:         return $this->frozen;
50:     }
51: 
52: 
53: 
54:     /**
55:      * Creates a modifiable clone of the object.
56:      * @return void
57:      */
58:     public function __clone()
59:     {
60:         $this->frozen = FALSE;
61:     }
62: 
63: 
64: 
65:     /**
66:      * @return void
67:      */
68:     protected function updating()
69:     {
70:         if ($this->frozen) {
71:             $class = get_class($this);
72:             throw new InvalidStateException("Cannot modify a frozen object $class.");
73:         }
74:     }
75: 
76: }
77: 
Nette Framework 2.0.0 API API documentation generated by ApiGen 2.7.0