Completed
Push — master ( babdb1...d3e076 )
by Siro Díaz
02:17
created

TrieNode::hasChildren()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * DataStructures for PHP
4
 *
5
 * @link      https://github.com/SiroDiaz/DataStructures
6
 * @copyright Copyright (c) 2017 Siro Díaz Palazón
7
 * @license   https://github.com/SiroDiaz/DataStructures/blob/master/README.md (MIT License)
8
 */
9
namespace DataStructures\Trees\Nodes;
10
11
/**
12
 * TrieNode.
13
 *
14
 * The TrieNode class represents the trie node. It uses an array to store all
15
 * children nodes.
16
 *
17
 * @author Siro Diaz Palazon <[email protected]>
18
 */
19
class TrieNode {
20
    public $char;
21
    public $isWord;
22
    public $children;
23
24
    public function __construct($char = '', $isWord = false) {
25
        $this->char = $char;
26
        $this->isWord = $isWord;
27
        $this->children = [];
28
    }
29
30
    public function hasChildren() {
31
        return count($this->children) > 0;
32
    }
33
}