PDepend\Source\AST\ASTCompilationUnit::__wakeup PHP Method

__wakeup() public method

The magic wakeup method will is called by PHP's runtime environment when a serialized instance of this class was unserialized. This implementation of the wakeup method restores the references between all parsed entities in this source file and this file instance.
See also: PDepend\Source\AST\ASTCompilationUnit::$childNodes
Since: 0.10.0
public __wakeup ( ) : void
return void
    public function __wakeup()
    {
        $this->cached = true;
        foreach ($this->childNodes as $childNode) {
            $childNode->setCompilationUnit($this);
        }
    }

Usage Example

 /**
  * testMagicWakeupMethodInvokesSetSourceFileOnChildNodes
  *
  * @return void
  */
 public function testMagicWakeupMethodInvokesSetSourceFileOnChildNodes()
 {
     $node = $this->getMock('PDepend\\Source\\AST\\ASTClass', array('setCompilationUnit'), array(__CLASS__));
     $node->expects($this->once())->method('setCompilationUnit')->with(self::isInstanceOf('PDepend\\Source\\AST\\ASTCompilationUnit'));
     $compilationUnit = new ASTCompilationUnit(__FILE__);
     $compilationUnit->addChild($node);
     $compilationUnit->__wakeup();
 }