<commit_before><?php

namespace Symfony\Cmf\Bundle\PHPCRBrowserBundle\Tree;

use PHPCR\SessionInterface;

/**
 * A simple class to get PHPCR trees in JSON format
 *
 * @author Jacopo 'Jakuza' Romei <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 */
class PHPCRTree implements TreeInterface
{
    private $session;
    
    public function __construct(SessionInterface $session)
    {
        $this->session = $session;
    }
    
    public function getChildren($path)
    {
        $root = $this->session->getNode($path);

        $children = array();

        foreach ($root->getNodes() as $name => $node) {
            $child = array(
                'data'  => $name,
                'attr'  => array('id' => $node->getPath()),
                'state' => 'closed'
            );

            foreach ($node->getNodes('*') as $name => $grandson) {
                $child['children'][] = array(
                    'data' => $name, 
                    'attr'  => array('id' => $grandson->getPath()),
                    'state' => 'closed');<commit_msg>Better leaf management. It will be featuring proper icons asap.<commit_after><?php

namespace Symfony\Cmf\Bundle\PHPCRBrowserBundle\Tree;

use PHPCR\SessionInterface;

/**
 * A simple class to get PHPCR trees in JSON format
 *
 * @author Jacopo 'Jakuza' Romei <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 */
class PHPCRTree implements TreeInterface
{
    private $session;
    
    public function __construct(SessionInterface $session)
    {
        $this->session = $session;
    }
    
    public function getChildren($path)
    {
        $root = $this->session->getNode($path);

        $children = array();

        foreach ($root->getNodes() as $name => $node) {
            $child = array(
                'data'  => $name,
                'attr'  => array('id' => $node->getPath()),
                'state' => 'closed'
            );

            foreach ($node->getNodes('*') as $name => $grandson) {
                $child['children'][] = array(
                    'data' => $name, 
                    'attr'  => array('id' => $grandson->getPath()),
                    'state' => count($grandson->getNodes('*')) ? 'closed' : 'open');
{'fraction_non_alphanumeric': 0.16095107453132146, 'fraction_numerical': 0.0, 'mean_word_length': 2.0346740638002774, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 48, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '611040', 'n_tokens_mistral': 655, 'n_tokens_neox': 628, 'n_words': 150}