private function buildTree($account, &$data, $parent) {
    $data[] = array($account['name'], null, 1);
    if ($account['subAccounts']) {
      foreach($account['subAccounts'] as $subAccount) {
        $this->buildTree($subAccount, $data, $account['name']);
      }
    }
  }
private function buildTree($account, &$data, $parent) {
    $data[] = array($account['name'], null, 1);
    if ($account['subAccounts']) {
      foreach($account['subAccounts'] as $subAccount) {
        $this->buildTree($subAccount, $data, $account['name']);
      }
    }
  }
private function buildTree ( $ account , & $ data , $ parent ) { $ data [ ] = array ( $ account [ 'name' ] , null , 1 ) ; if ( $ account [ 'subAccounts' ] ) { foreach ( $ account [ 'subAccounts' ] as $ subAccount ) { $ this -> buildTree ( $ subAccount , $ data , $ account [ 'name' ] ) ; } } }
Builds the data structure to represent the tree from the API response.
@param array $account The response of the API
@param array $data The data structure that represent the tree
@param string $parent The parent for the current node
Builds the data structure to represent the tree from the API response .