Create the encoded string
@param Image $Object
@param string $Settings
@return array
548947
public function drawSpring(Image $Object, array $Settings = [])
    {
        $this->pChartObject = $Object;

        $Pass = isset($Settings["Pass"]) ? $Settings["Pass"] : 50;
        $Retries = isset($Settings["Retry"]) ? $Settings["Retry"] : 10;
        $this->MagneticForceA = isset($Settings["MagneticForceA"]) ? $Settings["MagneticForceA"] : 1.5;
        $this->MagneticForceR = isset($Settings["MagneticForceR"]) ? $Settings["MagneticForceR"] : 2;
        $this->RingSize = isset($Settings["RingSize"]) ? $Settings["RingSize"] : 40;
        $DrawVectors = isset($Settings["DrawVectors"]) ? $Settings["DrawVectors"] : false;
        $DrawQuietZone = isset($Settings["DrawQuietZone"]) ? $Settings["DrawQuietZone"] : false;
        $CenterGraph = isset($Settings["CenterGraph"]) ? $Settings["CenterGraph"] : true;
        $TextPadding = isset($Settings["TextPadding"]) ? $Settings["TextPadding"] : 4;
        $Algorithm = isset($Settings["Algorithm"]) ? $Settings["Algorithm"] : ALGORITHM_WEIGHTED;

        $this->X1 = $Object->GraphAreaX1;
        $this->Y1 = $Object->GraphAreaY1;
        $this->X2 = $Object->GraphAreaX2;
        $this->Y2 = $Object->GraphAreaY2;

        $Conflicts = 1;
        $Jobs = 0;
        $this->History["MinimumConflicts"] = -1;
        while ($Conflicts != 0 && $Jobs < $Retries) {
            $Jobs++;

            /* Compute the initial settings */
            $this->firstPass($Algorithm);

            /* Apply the vectors */
            if ($Pass > 0) {
                for ($i = 0; $i <= $Pass; $i++) {
                    $this->doPass();
                }
            }

            $Conflicts = $this->lastPass();
            if ($this->History["MinimumConflicts"] == -1
                || $Conflicts < $this->History["MinimumConflicts"]
            ) {
                $this->History["MinimumConflicts"] = $Conflicts;
                $this->History["Result"] = $this->Data;
            }
        }

        $Conflicts = $this->History["MinimumConflicts"];
        $this->Data = $this->History["Result"];

        if ($CenterGraph) {
            $this->center();
        }

        /* Draw the connections */
        $Drawn = [];
        foreach ($this->Data as $Key => $Settings) {
            $X = $Settings["X"];
            $Y = $Settings["Y"];

            if (isset($Settings["Connections"])) {
                foreach ($Settings["Connections"] as $ID => $NodeID) {
                    if (!isset($Drawn[$Key])) {
                        $Drawn[$Key] = "";
                    }
                    if (!isset($Drawn[$NodeID])) {
                        $Drawn[$NodeID] = "";
                    }

                    if (isset($this->Data[$NodeID])
                        && !isset($Drawn[$Key][$NodeID])
                        && !isset($Drawn[$NodeID][$Key])
                    ) {
                        $Color = [
                            "R" => $this->Default["LinkR"],
                            "G" => $this->Default["LinkG"],
                            "B" => $this->Default["LinkB"],
                            "Alpha" => $this->Default["Alpha"]
                        ];

                        if (count($this->Links)) {
                            if (isset($this->Links[$Key][$NodeID]["R"])) {
                                $Color = [
                                    "R" => $this->Links[$Key][$NodeID]["R"],
                                    "G" => $this->Links[$Key][$NodeID]["G"],
                                    "B" => $this->Links[$Key][$NodeID]["B"],
                                    "Alpha" => $this->Links[$Key][$NodeID]["Alpha"]
                                ];
                            }

                            if (isset($this->Links[$Key][$NodeID]["Ticks"])) {
                                $Color["Ticks"] = $this->Links[$Key][$NodeID]["Ticks"];
                            }
                        }

                        $X2 = $this->Data[$NodeID]["X"];
                        $Y2 = $this->Data[$NodeID]["Y"];
                        $this->pChartObject->drawLine($X, $Y, $X2, $Y2, $Color);
                        $Drawn[$Key][$NodeID] = true;

                        if (isset($this->Links) && count($this->Links)) {
                            if (isset($this->Links[$Key][$NodeID]["Name"])
                                || isset($this->Links[$NodeID][$Key]["Name"])
                            ) {
                                $Name = isset($this->Links[$Key][$NodeID]["Name"])
                                    ? $this->Links[$Key][$NodeID]["Name"]
                                    : $this->Links[$NodeID][$Key]["Name"]
                                ;
                                $TxtX = ($X2 - $X) / 2 + $X;
                                $TxtY = ($Y2 - $Y) / 2 + $Y;

                                if ($X <= $X2) {
                                    $Angle = (360 - $this->getAngle($X, $Y, $X2, $Y2)) % 360;
                                } else {
                                    $Angle = (360 - $this->getAngle($X2, $Y2, $X, $Y)) % 360;
                                }
                                $Settings = $Color;
                                $Settings["Angle"] = $Angle;
                                $Settings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE;
                                $this->pChartObject->drawText($TxtX, $TxtY, $Name, $Settings);
                            }
                        }
                    }
                }
            }
        }

        /* Draw the quiet zones */
        if ($DrawQuietZone) {
            foreach ($this->Data as $Key => $Settings) {
                $X = $Settings["X"];
                $Y = $Settings["Y"];
                $FreeZone = $Settings["FreeZone"];

                $this->pChartObject->drawFilledCircle(
                    $X,
                    $Y,
                    $FreeZone,
                    ["R" => 0, "G" => 0, "B" => 0, "Alpha" => 2]
                );
            }
        }


        /* Draw the nodes */
        foreach ($this->Data as $Key => $Settings) {
            $X = $Settings["X"];
            $Y = $Settings["Y"];
            $Name = $Settings["Name"];
            $FreeZone = $Settings["FreeZone"];
            $Shape = $Settings["Shape"];
            $Size = $Settings["Size"];

            $Color = [
                "R" => $Settings["R"],
                "G" => $Settings["G"],
                "B" => $Settings["B"],
                "Alpha" => $Settings["Alpha"],
                "BorderR" => $Settings["BorderR"],
                "BorderG" => $Settings["BorderG"],
                "BorderB" => $Settings["BorderB"],
                "BorderApha" => $Settings["BorderAlpha"]
            ];

            if ($Shape == NODE_SHAPE_CIRCLE) {
                $this->pChartObject->drawFilledCircle($X, $Y, $Size, $Color);
            } elseif ($Shape == NODE_SHAPE_TRIANGLE) {
                $Points = [];
                $Points[] = cos(deg2rad(270)) * $Size + $X;
                $Points[] = sin(deg2rad(270)) * $Size + $Y;
                $Points[] = cos(deg2rad(45)) * $Size + $X;
                $Points[] = sin(deg2rad(45)) * $Size + $Y;
                $Points[] = cos(deg2rad(135)) * $Size + $X;
                $Points[] = sin(deg2rad(135)) * $Size + $Y;
                $this->pChartObject->drawPolygon($Points, $Color);
            } elseif ($Shape == NODE_SHAPE_SQUARE) {
                $Offset = $Size / 2;
                $Size = $Size / 2;
                $this->pChartObject->drawFilledRectangle(
                    $X - $Offset,
                    $Y - $Offset,
                    $X + $Offset,
                    $Y + $Offset,
                    $Color
                );
            }

            if ($Name != "") {
                $LabelOptions = [
                    "R" => $this->Labels["R"],
                    "G" => $this->Labels["G"],
                    "B" => $this->Labels["B"],
                    "Alpha" => $this->Labels["Alpha"]
                ];

                if ($this->Labels["Type"] == LABEL_LIGHT) {
                    $LabelOptions["Align"] = TEXT_ALIGN_BOTTOMLEFT;
                    $this->pChartObject->drawText($X, $Y, $Name, $LabelOptions);
                } elseif ($this->Labels["Type"] == LABEL_CLASSIC) {
                    $LabelOptions["Align"] = TEXT_ALIGN_TOPMIDDLE;
                    $LabelOptions["DrawBox"] = true;
                    $LabelOptions["BoxAlpha"] = 50;
                    $LabelOptions["BorderOffset"] = 4;
                    $LabelOptions["RoundedRadius"] = 3;
                    $LabelOptions["BoxRounded"] = true;
                    $LabelOptions["NoShadow"] = true;

                    $this->pChartObject->drawText($X, $Y + $Size + $TextPadding, $Name, $LabelOptions);
                }
            }
        }

        /* Draw the vectors */
        if ($DrawVectors) {
            foreach ($this->Data as $Key => $Settings) {
                $X1 = $Settings["X"];
                $Y1 = $Settings["Y"];

                if (isset($Settings["Vectors"]) && $Settings["Type"] != NODE_TYPE_CENTRAL) {
                    foreach ($Settings["Vectors"] as $ID => $Vector) {
                        $Type = $Vector["Type"];
                        $Force = $Vector["Force"];
                        $Angle = $Vector["Angle"];
                        $Factor = $Type == "A" ? $this->MagneticForceA : $this->MagneticForceR;
                        $Color = $Type == "A"
                            ? ["FillR" => 255, "FillG" => 0, "FillB" => 0]
                            : ["FillR" => 0, "FillG" => 255, "FillB" => 0]
                        ;

                        $X2 = cos(deg2rad($Angle)) * $Force * $Factor + $X1;
                        $Y2 = sin(deg2rad($Angle)) * $Force * $Factor + $Y1;

                        $this->pChartObject->drawArrow($X1, $Y1, $X2, $Y2, $Color);
                    }
                }
            }
        }

        return ["Pass" => $Jobs, "Conflicts" => $Conflicts];
    }
201546
public static function type_json_encode($var, array $settings)
	{
		$var = json_encode($var);

		if (array_key_exists('character_maximum_length', $settings))
		{
			$length  = intval($settings['character_maximum_length']);
			if ($length > 0 and strlen($var) > $length)
			{
				throw new InvalidContentType('Value could not be JSON encoded, exceeds max string length for field.');
			}
		}

		return $var;
	}
926018
public function hash($object, $keys)
    {
        $keyValues = array_map(
            function ($k) use ($object) {
                $a = is_array($k);
                return sprintf('%s=%s',$a?$k[1]:$k, $object->{$a?$k[0]:$k});
            },
            $keys
        );

        return sprintf('%s[%s]', $this->_class, implode(',', $keyValues));
    }
1098428
public function objectToString($object, $options = array())
	{
		$bitMask = isset($options['bitmask']) ? $options['bitmask'] : 0;

		// The depth parameter is only present as of PHP 5.5
		if (version_compare(PHP_VERSION, '5.5', '>='))
		{
			$depth = isset($options['depth']) ? $options['depth'] : 512;

			return json_encode($object, $bitMask, $depth);
		}

		return json_encode($object, $bitMask);
	}
436887
public function objectToString($object, array $options=[])
  {
    $vars = '';
    foreach(get_object_vars($object) as $k => $v){
      if ( is_scalar($v) ){
        $vars .= "\tpublic $" . $k . " = '" . addcslashes($v, '\\\'') . "';\n";
      }
      elseif ( is_array($v) || is_object($v) ){
        $vars .= "\tpublic $" . $k . " = " . $this->getArrayString((array) $v) . ";\n";
      }
    }
    
    $str = "<?php\nclass " . $options['class'] . " {\n";
    $str .= $vars;
    $str .= "}";

    if ( !isset($options['closingtag']) || $options['closingtag'] !== false ){
      $str .= "\n?>";
    }

    return $str;
  }
959262
protected function generateToken ($object)
	{
		$token = get_class ($object);

		if ($pos = strrpos ($token, "\\")) {
			$token = strtolower (substr ($token, $pos + 1));
		}

		if (isset ($this->tokens[$token]))
		{
			$i = 1;
			$tmp = $token . $i;
			while (isset ($this->tokens[$tmp]))
			{
				$i ++;
			}
			$token = $tmp;
		}

		$this->tokens[$token] = true;
		return $token;
	}
378310
public static function generateToken($secret, $object)
    {
        try
        {
            return (new TokenGenerator($secret))
                            ->setData($object)
                            ->create();
        } catch (TokenException $e)
        {
            $e->getMessage();
            return false;
        }
    }
944552
public function save(string $object, ...$options)
    {
        if (!$this->exists($object)) {
            $this->registry[$object] = [];
        }

        return;
    }
976693
public static function settingsSend($settings, $settings_url, &$debug_log=false) {

        $key_key = self::ltiParameter('key_key');
        $secret = self::decrypt_secret(self::ltiParameter('secret'));

        $retval = LTI::sendJSONSettings($settings, $settings_url, $key_key, $secret, $debug_log);
        return $retval;
    }
231226
public function serialize($object)
    {
        $pageNumber = $object->getPageNumber();
        if ($object instanceof ArticlePageDocument) {
            // resolve proxy to ensure that this will also be serialized
            $object = $object->getParent();

            $object->getTitle();
        }

        $result = $this->serializer->serialize(
            $object,
            'json',
            SerializationContext::create()
                ->setSerializeNull(true)
                ->setGroups(['preview'])
        );

        return json_encode(['pageNumber' => $pageNumber, 'object' => $result]);
    }
1113762
public function save($object)
    {

        if (is_array($object)) {
            $objectData = $object;
            $newPassword = "";
            if (isset($object['id']) && $object['id'] > 0) {
                $object = $this->find($object['id']);
            } else {
                $object = new User();
            }
            if (isset($objectData['password'])) {
                $newPassword = $objectData['password'];
            }
            if (isset($objectData['enabled']) && $objectData['enabled']) {
                $object->enable();
            } else {
                $object->disable();
            }
            unset($objectData['enabled']);
            if (isset($objectData['groups'])) {
                $groups = $objectData['groups'];
                $groups = array_unique($groups);
                $object->setGroups(array());
                foreach ($groups as $groupId) {
                    $group = $this->groupManager->find($groupId);
                    $object->addGroup($group);
                }
                unset($objectData['groups']);
            }
            $this->assignArrayToObject($object, $objectData);
        } else if (!($object instanceof UserInterface)) {
            $this->addErrorMessage(self::ERROR_WRONG_OBJECT);
        }

        if (!$this->hasError()) {
            if (!empty($newPassword)) {
                $check = $this->userManager->changeUserPassword($object, $newPassword);
                if ($check !== true) {
                    foreach ($check as $pwError) {
                        $this->addErrorMessage($pwError);
                    }
                    $check = false;
                }
            } else {
                $check = $this->userManager->updateUser($object);
            }
            if ($check === true) {
                $this->addSuccessMessage(self::SUCCESS_SAVED);
            }
        }

        return $object;
    }
714769
protected function buildRequestUri(Server $server, array $query = [], array $settings = []): string
    {
        $uri = $server->getOptions()->getProtocol() . '://' . $server->getHost() . ':' . $server->getPort();

        if (!is_null($server->getDatabase())) {
            $query['database'] = $server->getDatabase();
        }

        if (!is_null($server->getUsername())) {
            $query['user'] = $server->getUsername();
        }

        if (!is_null($server->getPassword())) {
            $query['password'] = $server->getPassword();
        }

        $query = array_merge($query, $settings);

        return $uri . '?' . http_build_query($query);
    }
958938
public function normalize($object, $format = null, array $context = [])
    {
        /* @var \Apigee\Edge\Structure\CredentialProductInterface $object */
        return (object) [
            'apiproduct' => $object->getApiproduct(),
            'status' => $object->getStatus(),
        ];
    }
388488
public static function type_string($var, array $settings)
	{
		if (is_array($var) or (is_object($var) and ! method_exists($var, '__toString')))
		{
			throw new InvalidContentType('Array or object could not be converted to varchar.');
		}

		$var = strval($var);

		if (array_key_exists('character_maximum_length', $settings))
		{
			$length  = intval($settings['character_maximum_length']);
			if ($length > 0 and strlen($var) > $length)
			{
				$var = substr($var, 0, $length);
			}
		}

		return $var;
	}
530709
public function execute(object $object, array $properties, array $methodPrefixes = ['set', 'add']): object
    {
        try {
            foreach ($properties as $property => $value) {
                if (false === $this->assignValueWithSetterMethod($object, [$property, $value], $methodPrefixes)) {
                    $object->$property = $value;
                }
            }

            return $object;
        } catch (\Throwable $t) {
            throw new PropertyNotAccessibleException($t->getMessage());
        }
    }
1181256
private function _setFields($object, $fields)
    {
        $fields = is_array($fields) ? $fields : [];
        foreach ($fields as $sKey => $sValue) {
            $object->$sKey = oxNew('oxField', $sValue);
        }

        return $object;
    }
990534
public function configureObject($object, $properties) {
        foreach ($properties as $name => $value) {
            $object->$name = $value;
        }

        return $object;
    }