Code Duplication    Length = 7-8 lines in 3 locations

src/prototype.php 3 locations

@@ 133-140 (lines=8) @@
130
     * The object becomes immutable. Any attempt to change the object will silently fail.
131
     * @param \arc\prototype\Prototype $prototype the object to freeze
132
     */
133
    public static function freeze(prototype\Prototype $prototype) :void
134
    {
135
        if (!isset(self::$frozen)) {
136
            self::$frozen = new \SplObjectStorage();
137
        }
138
        self::seal($prototype);
139
        self::$frozen[$prototype] = true;
140
    }
141
142
    /**
143
     * This prevents reconfiguring an object or adding new properties.
@@ 146-153 (lines=8) @@
143
     * This prevents reconfiguring an object or adding new properties.
144
     * @param \arc\prototype\Prototype $prototype the object to freeze
145
     */
146
    public static function seal(prototype\Prototype $prototype) :void
147
    {
148
        if (!isset(self::$sealed)) {
149
            self::$sealed = new \SplObjectStorage();
150
        }
151
        self::preventExtensions($prototype);
152
        self::$sealed[$prototype] = true;
153
    }
154
155
    /**
156
     * Returns a list of keys of all the properties in the given prototype
@@ 322-328 (lines=7) @@
319
     * Makes an object no longer extensible.
320
     * @param \arc\prototype\Prototype $prototype
321
     */
322
    public static function preventExtensions(prototype\Prototype $prototype) :void
323
    {
324
        if ( !isset(self::$notExtensible) ) {
325
            self::$notExtensible = new \SplObjectStorage();
326
        }
327
        self::$notExtensible[$prototype] = true;
328
    }
329
330
    /**
331
     * Removes an observer callback for the given prototype.