Esempio n. 1
0
 /**
  * Create a new Chart
  *
  * @param StringType $chartName
  * @param Organisation $org
  * @param ChartDefinition $def
  *
  * @return Chart
  */
 public function createChart(StringType $chartName, Organisation $org, ChartDefinition $def)
 {
     return FFor::create()->dom(function () use($def) {
         return $def->getDefinition();
     })->xpath(function ($dom) {
         return new \DOMXPath($dom);
     })->root(function ($xpath) {
         return $xpath->query('/chart/account')->item(0);
     })->tree(function () {
         return new Node();
     })->chart(function ($tree) use($chartName, $org) {
         return new Chart($chartName, $org, $tree);
     })->build(function ($root, $tree, $chart) {
         $this->buildTree($tree, $root, $chart, AccountType::toArray());
     })->fyield('chart');
 }