private function prepareDraftForCommit(AbstractClassContent $content, Revision $draft, array $data)
    {
        if ($content instanceof ContentSet) {
            if (!isset($data['elements']) || false === $data['elements']) {
                $draft->clear();
                foreach ($content->getData() as $element) {
                    $draft->push($element);
                }
            }
        } elseif (AbstractClassContent::STATE_NORMAL === $content->getState()) {
            foreach ($content->getData() as $key => $element) {
                if (!isset($data['elements']) || !in_array($key, $data['elements'])) {
                    $draft->$key = $content->$key;
                }
            }
        }

        if (isset($data['parameters'])) {
            foreach ($content->getAllParams() as $key => $params) {
                if (!in_array($key, $data['parameters'])) {
                    $draft->setParam($key, $content->getParamValue($key));
                }
            }
        }

        if (isset($data['message'])) {
            $draft->setComment($data['message']);
        }

        return $this;
    }
private function prepareDraftForCommit(AbstractClassContent $content, Revision $draft, array $data)
    {
        if ($content instanceof ContentSet) {
            if (!isset($data['elements']) || false === $data['elements']) {
                $draft->clear();
                foreach ($content->getData() as $element) {
                    $draft->push($element);
                }
            }
        } elseif (AbstractClassContent::STATE_NORMAL === $content->getState()) {
            foreach ($content->getData() as $key => $element) {
                if (!isset($data['elements']) || !in_array($key, $data['elements'])) {
                    $draft->$key = $content->$key;
                }
            }
        }

        if (isset($data['parameters'])) {
            foreach ($content->getAllParams() as $key => $params) {
                if (!in_array($key, $data['parameters'])) {
                    $draft->setParam($key, $content->getParamValue($key));
                }
            }
        }

        if (isset($data['message'])) {
            $draft->setComment($data['message']);
        }

        return $this;
    }
private function prepareDraftForCommit ( AbstractClassContent $ content , Revision $ draft , array $ data ) { if ( $ content instanceof ContentSet ) { if ( ! isset ( $ data [ 'elements' ] ) || false === $ data [ 'elements' ] ) { $ draft -> clear ( ) ; foreach ( $ content -> getData ( ) as $ element ) { $ draft -> push ( $ element ) ; } } } elseif ( AbstractClassContent :: STATE_NORMAL === $ content -> getState ( ) ) { foreach ( $ content -> getData ( ) as $ key => $ element ) { if ( ! isset ( $ data [ 'elements' ] ) || ! in_array ( $ key , $ data [ 'elements' ] ) ) { $ draft -> $ key = $ content -> $ key ; } } } if ( isset ( $ data [ 'parameters' ] ) ) { foreach ( $ content -> getAllParams ( ) as $ key => $ params ) { if ( ! in_array ( $ key , $ data [ 'parameters' ] ) ) { $ draft -> setParam ( $ key , $ content -> getParamValue ( $ key ) ) ; } } } if ( isset ( $ data [ 'message' ] ) ) { $ draft -> setComment ( $ data [ 'message' ] ) ; } return $ this ; }
Prepares draft for commit.

@param  AbstractClassContent $content
@param  Revision             $draft
@param  array                $data

@return ClassContentManager
Prepares draft for commit .