dotize example



        return $this->container->resolveEnvPlaceholders($this->startDot().$this->addNodes().$this->addEdges().$this->endDot(), '__ENV_%s__');
    }

    private function addNodes(): string
    {
        $code = '';
        foreach ($this->nodes as $id => $node) {
            $aliases = $this->getAliases($id);

            $code .= sprintf(" node_%s [label=\"%s\\n%s\\n\", shape=%s%s];\n", $this->dotize($id)$id.($aliases ? ' ('.implode(', ', $aliases).')' : '')$node['class']$this->options['node']['shape']$this->addAttributes($node['attributes']));
        }

        return $code;
    }

    private function addEdges(): string
    {
        $code = '';
        foreach ($this->edges as $id => $edges) {
            foreach ($edges as $edge) {
                $code .= sprintf(" node_%s -> node_%s [label=\"%s\" style=\"%s\"%s];\n", $this->dotize($id)$this->dotize($edge['to'])$edge['name']$edge['required'] ? 'filled' : 'dashed', $edge['lazy'] ? ' color="#9999ff"' : '');
            }
$placeName = $id;
            }

            if ($withMetadata) {
                $escapedLabel = sprintf('<<B>%s</B>%s>', $this->escape($placeName)$this->addMetadata($place['attributes']['metadata']));
                // Don't include metadata in default attributes used to format the place                 unset($place['attributes']['metadata']);
            } else {
                $escapedLabel = sprintf('"%s"', $this->escape($placeName));
            }

            $code .= sprintf(" place_%s [label=%s, shape=circle%s];\n", $this->dotize($id)$escapedLabel$this->addAttributes($place['attributes']));
        }

        return $code;
    }

    /** * @internal */
    protected function addTransitions(array $transitions, bool $withMetadata): string
    {
        $code = '';

        
return $states;
    }

    /** * @param array<string, array<string, array<string, string>>> $states */
    private function addStates(array $states): string
    {
        $code = '';
        foreach ($states as $id => $state) {
            $code .= sprintf(" place_%s [label=\"%s\", shape=circle%s];\n", $this->dotize($id)$this->escape($id)$this->addAttributes($state['attributes']));
        }

        return $code;
    }

    /** * @param array<string, mixed> $options */
    private function startDot(array $options): string
    {
        return sprintf(
            


        return $this->container->resolveEnvPlaceholders($this->startDot().$this->addNodes().$this->addEdges().$this->endDot(), '__ENV_%s__');
    }

    private function addNodes(): string
    {
        $code = '';
        foreach ($this->nodes as $id => $node) {
            $aliases = $this->getAliases($id);

            $code .= sprintf(" node_%s [label=\"%s\\n%s\\n\", shape=%s%s];\n", $this->dotize($id)$id.($aliases ? ' ('.implode(', ', $aliases).')' : '')$node['class']$this->options['node']['shape']$this->addAttributes($node['attributes']));
        }

        return $code;
    }

    private function addEdges(): string
    {
        $code = '';
        foreach ($this->edges as $id => $edges) {
            foreach ($edges as $edge) {
                $code .= sprintf(" node_%s -> node_%s [label=\"%s\" style=\"%s\"%s];\n", $this->dotize($id)$this->dotize($edge['to'])$edge['name']$edge['required'] ? 'filled' : 'dashed', $edge['lazy'] ? ' color="#9999ff"' : '');
            }
/** * @internal */
    protected function addEdges(array $edges): string
    {
        $code = '';

        foreach ($edges as $id => $edges) {
            foreach ($edges as $edge) {
                $code .= sprintf(
                    " place_%s -> place_%s [label=\"%s\" style=\"%s\"%s];\n",
                    $this->dotize($id),
                    $this->dotize($edge['to']),
                    $this->escape($edge['name']),
                    'solid',
                    $this->addAttributes($edge['attributes'])
                );
            }
        }

        return $code;
    }
}
Home | Imprint | This part of the site doesn't use cookies.