Provides some backwards compatability

@param \stdClass $oBindTo The class to bind to
965241
public static function backwardsCompatibility(&$oBindTo)
    {
        /**
         * Backwards compatibility
         * Various older modules expect to be able to access a few services/models
         * via magic methods. These will be deprecated soon.
         */

        //  @todo (Pablo - 2017-06-07) - Remove these
        $oBindTo->db                  = Factory::service('Database');
        $oBindTo->input               = Factory::service('Input');
        $oBindTo->output              = Factory::service('Output');
        $oBindTo->meta                = Factory::service('Meta');
        $oBindTo->asset               = Factory::service('Asset');
        $oBindTo->encrypt             = Factory::service('Encrypt');
        $oBindTo->logger              = Factory::service('Logger');
        $oBindTo->uri                 = Factory::service('Uri');
        $oBindTo->security            = Factory::service('Security');
        $oBindTo->emailer             = Factory::service('Emailer', 'nails/module-email');
        $oBindTo->event               = Factory::service('Event', 'nails/module-event');
        $oBindTo->session             = Factory::service('Session', 'nails/module-auth');
        $oBindTo->user                = Factory::model('User', 'nails/module-auth');
        $oBindTo->user_group_model    = Factory::model('UserGroup', 'nails/module-auth');
        $oBindTo->user_password_model = Factory::model('UserPassword', 'nails/module-auth');

        //  Set variables for the views, too
        $oBindTo->data['user']          = $oBindTo->user;
        $oBindTo->data['user_group']    = $oBindTo->user_group_model;
        $oBindTo->data['user_password'] = $oBindTo->user_password_model;
    }
1086702
function createDifferenceObject( $fromData, $toData )
    {
        $changes = new eZXMLTextDiff();
        $contentINI = eZINI::instance( 'content.ini' );
        $useSimplifiedXML = $contentINI->variable( 'ContentVersionDiffSettings', 'UseSimplifiedXML' );
        $diffSimplifiedXML = ( $useSimplifiedXML == 'enabled' );

        $oldXMLTextObject = $fromData->content();
        $newXMLTextObject = $toData->content();

        $oldXML = $oldXMLTextObject->attribute( 'xml_data' );
        $newXML = $newXMLTextObject->attribute( 'xml_data' );

        $simplifiedXML = new eZSimplifiedXMLEditOutput();

        $domOld = new DOMDocument( '1.0', 'utf-8' );
        $domOld->preserveWhiteSpace = false;
        $domOld->loadXML( $oldXML );

        $domNew = new DOMDocument( '1.0', 'utf-8' );
        $domNew->preserveWhiteSpace = false;
        $domNew->loadXML( $newXML );

        $old = $simplifiedXML->performOutput( $domOld );
        $new = $simplifiedXML->performOutput( $domNew );

        if ( !$diffSimplifiedXML )
        {
            $old = trim( strip_tags( $old ) );
            $new = trim( strip_tags( $new ) );

            $pattern = array( '/[ ][ ]+/',
                              '/ \n( \n)+/',
                              '/^ /m',
                              '/(\n){3,}/' );
            $replace = array( ' ',
                              "\n",
                              '',
                              "\n\n" );

            $old = preg_replace( $pattern, $replace, $old );
            $new = preg_replace( $pattern, $replace, $new );
        }

        $oldArray = explode( "\n", $old );
        $newArray = explode( "\n", $new );

        $oldSums = array();
        foreach( $oldArray as $paragraph )
        {
            $oldSums[] = crc32( $paragraph );
        }

        $newSums = array();
        foreach( $newArray as $paragraph )
        {
            $newSums[] = crc32( $paragraph );
        }

        $textDiffer = new eZDiffTextEngine();

        $pre = $textDiffer->preProcess( $oldSums, $newSums );
        $out = $textDiffer->createOutput( $pre, $oldArray, $newArray );
        $changes->setChanges( $out );
        return $changes;
    }
462871
public static function instance_from_object(stdClass $data) {
        $i = new self();

        if (!isset($data->numofreviews)) {
            throw new coding_exception('Missing value of the numofreviews property');
        } else {
            $i->numofreviews = (int)$data->numofreviews;
        }

        if (!isset($data->numper)) {
            throw new coding_exception('Missing value of the numper property');
        } else {
            $i->numper = (int)$data->numper;
            if ($i->numper !== self::NUMPER_SUBMISSION and $i->numper !== self::NUMPER_REVIEWER) {
                throw new coding_exception('Invalid value of the numper property');
            }
        }

        foreach (array('excludesamegroup', 'removecurrent', 'assesswosubmission', 'addselfassessment') as $k) {
            if (isset($data->$k)) {
                $i->$k = (bool)$data->$k;
            } else {
                $i->$k = false;
            }
        }

        return $i;
    }
114721
public function setupBindingDefinition(BindingDefinition $bd) {
		parent::setupBindingDefinition($bd);
		
		$bd->val($this->propertyName, new ValUrl($this->allowedSchemes, null, $this->relativeAllowed));
	}
569737
public function setIndexEngineIndex(ChildIndexEngineIndex $v = null)
    {
        if ($v === null) {
            $this->setId(null);
        } else {
            $this->setId($v->getId());
        }

        $this->aIndexEngineIndex = $v;

        // Add binding for other direction of this n:n relationship.
        // If this object has already been added to the ChildIndexEngineIndex object, it will not be re-added.
        if ($v !== null) {
            $v->addIndexEngineIndexVersion($this);
        }

        return $this;
    }
653461
protected function fixClassToThis(File $phpCsFile, int $classNameIndex, array $parts, string $appendix, array $returnTypes): void
    {
        $ownClassName = '\\' . $this->getClassName($phpCsFile);

        $result = [];
        foreach ($parts as $key => $part) {
            if ($part !== $ownClassName) {
                continue;
            }

            $parts[$key] = '$this';
            $result[$part] = '$this';
        }

        if (!$result) {
            return;
        }

        $isFluentInterfaceMethod = $returnTypes === ['$this'];
        if (!$isFluentInterfaceMethod) {
            return;
        }

        $message = [];
        foreach ($result as $part => $useStatement) {
            $message[] = $part . ' => ' . $useStatement;
        }

        $fix = $phpCsFile->addFixableError(implode(', ', $message), $classNameIndex, 'ClassVsThis');
        if ($fix) {
            $newContent = implode('|', $parts);
            $phpCsFile->fixer->replaceToken($classNameIndex, $newContent . $appendix);
        }
    }
198327
public function getClassIndex(): ClassIndex
    {
        if (is_null($this->classIndex)) {
            $this->classIndex = new ClassIndex();
        }

        return $this->classIndex;
    }
500890
public function dispatch(Controller $obj_controller)
    {
        $obj_controller->preDispatch();
        $obj_controller->dispatch();
        $obj_controller->postDispatch();
        $this->sendResponse($obj_controller->getResponse());
    }
609469
private function applyTransaction(\stdClass $obj_request) {
        if(null !== $this->str_next_transaction) {
            $obj_request->readOptions = (object)[
                // 'readConsistency' => $options->getReadConsistency(),
                "transaction" => $this->str_next_transaction
            ];
            $this->str_next_transaction = null;
        }
        return $obj_request;
    }
141087
function (oBinding, oTable) {
			// Code necessary for ClientTreeBinding
			var that = oTable;
			jQuery.extend(oBinding, {
				_init: function(bExpandFirstLevel) {
					this._bExpandFirstLevel = bExpandFirstLevel;
					// load the root contexts and create the context info map
					this.mContextInfo = {};
					this._initContexts();
					// expand the first level if required
					if (bExpandFirstLevel && !this._bFirstLevelExpanded) {
						this._expandFirstLevel();
					}
				},

				_initContexts: function(bSkipFirstLevelLoad) {
					// load the root contexts and create the context info map entry (if missing)
					this.aContexts = this.getRootContexts(0, Number.MAX_VALUE);
					for (var i = 0, l = this.aContexts.length; i < l; i++) {
						var oldContextInfo = this._getContextInfo(this.aContexts[i]);
						this._setContextInfo({
							oContext: this.aContexts[i],
							iLevel: 0,
							bExpanded: oldContextInfo ? oldContextInfo.bExpanded : false
						});
					}

					if (this._bExpandFirstLevel && !this._bFirstLevelExpanded) {
						this._expandFirstLevel(bSkipFirstLevelLoad);
					}
				},

				_expandFirstLevel: function (bSkipFirstLevelLoad) {
					var that = this;
					if (this.aContexts && this.aContexts.length > 0) {
						jQuery.each(this.aContexts.slice(), function(iIndex, oContext) {
							if (!bSkipFirstLevelLoad) {
								that._loadChildContexts(oContext);
							}
							that._getContextInfo(oContext).bExpanded = true;
						});

						this._bFirstLevelExpanded = true;
					}
				},

				_fnFireFilter: oBinding._fireFilter,
				_fireFilter: function() {
					this._fnFireFilter.apply(this, arguments);
					this._initContexts(true);
					this._restoreContexts(this.aContexts);
				},
				_fnFireChange: oBinding._fireChange,
				_fireChange: function() {
					this._fnFireChange.apply(this, arguments);
					this._initContexts(true);
					this._restoreContexts(this.aContexts);
				},
				_restoreContexts: function(aContexts) {
					var that = this;
					var aNewChildContexts = [];
					jQuery.each(aContexts.slice(), function(iIndex, oContext) {
						var oContextInfo = that._getContextInfo(oContext);
						if (oContextInfo && oContextInfo.bExpanded) {
							aNewChildContexts.push.apply(aNewChildContexts, that._loadChildContexts(oContext));
						}
					});
					if (aNewChildContexts.length > 0) {
						this._restoreContexts(aNewChildContexts);
					}
				},
				_loadChildContexts: function(oContext) {
					var oContextInfo = this._getContextInfo(oContext);
					var iIndex = (this.aContexts ? this.aContexts.indexOf(oContext) : -1);
					var aNodeContexts = this.getNodeContexts(oContext, 0, Number.MAX_VALUE);
					for (var i = 0, l = aNodeContexts.length; i < l; i++) {
						this.aContexts.splice(iIndex + i + 1, 0, aNodeContexts[i]);
						var oldContextInfo = this._getContextInfo(aNodeContexts[i]);
						this._setContextInfo({
							oParentContext: oContext,
							oContext: aNodeContexts[i],
							iLevel: oContextInfo.iLevel + 1,
							bExpanded: oldContextInfo ? oldContextInfo.bExpanded : false
						});
					}
					return aNodeContexts;
				},
				_getContextInfo: function(oContext) {
					return oContext ? this.mContextInfo[oContext.getPath()] : undefined;
				},
				_setContextInfo: function(mData) {
					if (mData && mData.oContext) {
						this.mContextInfo[mData.oContext.getPath()] = mData;
					}
				},
				getLength: function() {
					return this.aContexts ? this.aContexts.length : 0;
				},
				getContexts: function(iStartIndex, iLength) {
					return this.aContexts.slice(iStartIndex, iStartIndex + iLength);
				},
				getNodes: function(iStartIndex, iLength) {
					var aContexts = this.getContexts(iStartIndex, iStartIndex + iLength);
					//wrap contexts into node objects
					var aNodes = [];
					for (var i = 0; i < aContexts.length; i++) {
						var oContextInfo = this._getContextInfo(aContexts[i]) || {}; //empty object to make sure this does not break
						var oContext = aContexts[i];
						aNodes.push({
							context: oContext,
							level: oContextInfo.iLevel,
							parent: oContextInfo.oParentContext,
							nodeState: {
								expanded: oContextInfo.bExpanded,
								collapsed: !oContextInfo.bExpanded,
								selected: false //default should be false, correct value is given via the selection model
							}
						});
					}
					return aNodes;
				},
				hasChildren: function() {
					return true;
				},
				nodeHasChildren: function() {
					return true;
				},
				getContextByIndex: function (iRowIndex) {
					return this.aContexts[iRowIndex];
				},
				getLevel: function(oContext) {
					var oContextInfo = this._getContextInfo(oContext);
					return oContextInfo ? oContextInfo.iLevel : -1;
				},
				isExpanded: function(iRowIndex) {
					var oContext = this.getContextByIndex(iRowIndex);
					var oContextInfo = this._getContextInfo(oContext);
					return oContextInfo ? oContextInfo.bExpanded : false;
				},
				expandContext: function(oContext) {
					var oContextInfo = this._getContextInfo(oContext);
					if (oContextInfo && !oContextInfo.bExpanded) {
						this.storeSelection();
						this._loadChildContexts(oContext);
						oContextInfo.bExpanded = true;
						this._fireChange();
						this.restoreSelection();
					}
				},
				expand: function (iRowIndex) {
					this.expandContext(this.getContextByIndex(iRowIndex));
				},
				collapseContext: function(oContext, bSupressChanges) {
					var oContextInfo = this._getContextInfo(oContext);
					if (oContextInfo && oContextInfo.bExpanded) {
						this.storeSelection();
						for (var i = this.aContexts.length - 1; i > 0; i--) {
							if (this._getContextInfo(this.aContexts[i]).oParentContext === oContext) {
								this.aContexts.splice(i, 1);
							}
						}
						oContextInfo.bExpanded = false;
						if (!bSupressChanges) {
							this._fireChange();
						}
						this.restoreSelection();
					}
				},
				collapse: function (iRowIndex) {
					this.collapseContext(this.getContextByIndex(iRowIndex));
				},
				collapseToLevel: function (iLevel) {
					if (!iLevel || iLevel < 0) {
						iLevel = 0;
					}

					var aContextsCopy = this.aContexts.slice();
					for (var i = aContextsCopy.length - 1; i >= 0; i--) {
						var iContextLevel = this.getLevel(aContextsCopy[i]);
						if (iContextLevel != -1 && iContextLevel >= iLevel) {
							this.collapseContext(aContextsCopy[i], true);
						}
					}

					this._fireChange();
				},
				toggleContext: function(oContext) {
					var oContextInfo = this._getContextInfo(oContext);
					if (oContextInfo) {
						if (oContextInfo.bExpanded) {
							this.collapseContext(oContext);
						} else {
							this.expandContext(oContext);
						}
					}
				},
				toggleIndex: function (iRowIndex) {
					this.toggleContext(this.getContextByIndex(iRowIndex));
				},
				storeSelection: function() {
					var aSelectedIndices = that.getSelectedIndices();
					var aSelectedContexts = [];
					jQuery.each(aSelectedIndices, function(iIndex, iValue) {
						aSelectedContexts.push(that.getContextByIndex(iValue));
					});
					this._aSelectedContexts = aSelectedContexts;
				},
				restoreSelection: function() {
					that.clearSelection();
					var _aSelectedContexts = this._aSelectedContexts;
					jQuery.each(this.aContexts, function(iIndex, oContext) {
						if (((_aSelectedContexts ? _aSelectedContexts.indexOf(oContext) : -1)) >= 0) {
							that.addSelectionInterval(iIndex, iIndex);
						}
					});
					this._aSelectedContexts = undefined;
				},
				attachSelectionChanged: function() {
					// for compatibility reasons (OData Tree Binding)
					return undefined;
				},
				clearSelection: function () {
					that._oSelection.clearSelection();
				},
				attachSort: function() {},
				detachSort: function() {}
			});
			// initialize the binding
			oBinding._init(oTable.getExpandFirstLevel());

		}
843035
public function rollBack($rollBackTo = false)
    {
        if ($rollBackTo === false) {
            return $this->wlink->rollBack();
        } else {
            return $this->wlink->exec("ROLLBACK TO {$rollBackTo}");
        }
    }
1155974
protected function buildProperty(ClassProperty $property, $indent)
    {
        $visibility = 'public';

        if (false === $property->isPublic()) {
            $visibility = $property->isProtected() ? 'protected' : 'private';
        }

        if ($property->isStatic()) {
            $visibility = 'static '.$visibility;
        }

        $source = $visibility.' $'.$property->getName();
        $original = $property->getOriginal();

        if (isset($original['default'])) {
            $source .= ' = '.$this->wrapPHPValue([
                'default' => $original['default'],
            ]);
        }

        $docBlock = new DocBlock($property->getDocBlock(), $indent);

        return $docBlock."\n".$indent.$source.';';
    }
174242
protected function matchObjectWithClass(
        /*# string */ $classOrInterface,
        $objectToMatch
    )/*# : bool */ {
        if (is_object($objectToMatch) &&
            is_a($objectToMatch, $classOrInterface)) {
            return true;
        }
        return false;
    }
823362
public function setByObject(stdClass $object)
    {
        $vars = get_object_vars($object);

        if (is_array($vars)) {
            foreach ($vars as $property => $value) {
                $this->$property = $value;
            }
        }

        return $this;
    }
273934
public function appendClassTotalCrapIndex($sClassName, $iCrapIndex)
    {
        if (!isset($this->_aStats[$sClassName]['sum']['crap'])) {
            $this->_aStats[$sClassName]['sum']['crap'] = 0;
        }
        $this->_aStats[$sClassName]['sum']['crap'] += $iCrapIndex;
    }
1146200
public static function decodeToObj(string $stringData): \stdClass
    {
        $decoded = json_decode($stringData, false);

        if ($decoded === null) {
            $errNo = json_last_error();
            $msg = json_last_error_msg();
            throw new Exception("Unable to decode JSON string, error ({$errNo}): {$msg}", $errNo);
        }

        return $decoded;
    }
27379
public function updateFromObject(stdClass $object)
    {
        $this->customHeaders = property_exists($object, 'customHeaders') ? $object->customHeaders : null;

        $this->sender = null;

        if (property_exists($object, 'sender')) {
            $sender = new Contact();
            $sender->updateFromObject($object->sender);

            $this->sender = $sender;
        }

        $this->from    = ContactCollection::createFromObjects(property_exists($object, 'from') ? $object->from : null);
        $this->replyTo = ContactCollection::createFromObjects(property_exists($object, 'replyTo') ? $object->from : null);
        $this->to      = ContactCollection::createFromObjects(property_exists($object, 'to') ? $object->to : null);
        $this->cc      = ContactCollection::createFromObjects(property_exists($object, 'cc') ? $object->cc : null);
        $this->bcc     = ContactCollection::createFromObjects(property_exists($object, 'bcc') ? $object->bcc : null);

        $this->date      = property_exists($object, 'date') ? new DateTime($object->date) : null;
        $this->subject   = property_exists($object, 'subject') ? $object->subject : null;
        $this->inReplyTo = property_exists($object, 'inReplyTo') ? $object->inReplyTo : null;

        $this->bodyParts = EmailBodyPartCollection::createFromObjects(property_exists($object, 'bodyParts') ? $object->bodyParts : null);
    }