示例#1
0
    public function testEscaping()
    {
        $graph = new Graph();
        $graph->createVertex('a');
        $graph->createVertex('b¹²³ is; ok\\ay, "right"?');
        $graph->createVertex(3);
        $graph->createVertex(4)->setLayoutAttribute('label', 'normal');
        $graph->createVertex(5)->setLayoutAttribute('label', GraphViz::raw('<raw>'));
        $expected = <<<VIZ
graph G {
  "a"
  "b¹²³ is; ok\\\\ay, &quot;right&quot;?"
  3
  4 [label="normal"]
  5 [label=<raw>]
}

VIZ;
        $this->assertEquals($expected, $this->getDotScriptForGraph($graph));
    }
示例#2
0
 public function createVertexExtension($extension)
 {
     if ($extension instanceof ReflectionExtension) {
         $reflection = $class;
         $extension = $reflection->getName();
     } else {
         $reflection = new ReflectionExtension($extension);
     }
     $vertex = $this->graph->createVertex($extension);
     $vertex->setLayoutAttribute('shape', 'record');
     $vertex->setLayoutAttribute('label', GraphViz::raw($this->getLabelRecordExtension($reflection)));
     return $vertex;
 }