* @license MIT */ class MagicSleep extends MagicMethodGenerator { /** * Constructor */ public function __construct( ReflectionClass $originalClass, PropertyGenerator $prefixInterceptors, PropertyGenerator $suffixInterceptors ) { parent::__construct($originalClass, '__sleep'); $callParent = $originalClass->hasMethod('__sleep') ? '$returnValue = & parent::__sleep();' : '$returnValue = array_keys((array) $this);'; $this->setBody( InterceptorGenerator::createInterceptedMethodBody( $callParent, $this, $prefixInterceptors, $suffixInterceptors ) ); } }