vendor/elao/form-translation-bundle/Model/FormTreeNode.php line 18

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the ElaoFormTranslation bundle.
  4.  *
  5.  * Copyright (C) Elao
  6.  *
  7.  * @author Elao <contact@elao.com>
  8.  */
  9. namespace Elao\Bundle\FormTranslationBundle\Model;
  10. /**
  11.  * A node of the form Tree
  12.  *
  13.  * @author Thomas Jarrand <thomas.jarrand@gmail.com>
  14.  */
  15. class FormTreeNode
  16. {
  17.     /**
  18.      * The name of the node
  19.      *
  20.      * @var string
  21.      */
  22.     private $name;
  23.     /**
  24.      * Whether or not the node has labeled children.
  25.      *
  26.      * @var bool
  27.      */
  28.     private $children;
  29.     /**
  30.      * Whether or not the node is a collection.
  31.      *
  32.      * @var bool
  33.      */
  34.     private $collection;
  35.     /**
  36.      * Whether or not the node is a prototype.
  37.      *
  38.      * @var bool
  39.      */
  40.     private $prototype;
  41.     /**
  42.      * Constructor
  43.      *
  44.      * @param string $name       The node's name
  45.      * @param bool   $children   Whether or not the node has labeled children
  46.      * @param bool   $collection Is the node a collection
  47.      * @param bool   $prototype  Is the node a prototype
  48.      */
  49.     public function __construct($name$children false$collection false$prototype false)
  50.     {
  51.         $this->name = (string) $name;
  52.         $this->children = (bool) $children;
  53.         $this->collection = (bool) $collection;
  54.         $this->prototype = (bool) $prototype;
  55.     }
  56.     /**
  57.      * Get the name of the node
  58.      *
  59.      * @return string
  60.      */
  61.     public function getName()
  62.     {
  63.         return $this->name;
  64.     }
  65.     /**
  66.      * Does the node has labeled children?
  67.      *
  68.      * @return bool
  69.      */
  70.     public function hasChildren()
  71.     {
  72.         return $this->children;
  73.     }
  74.     /**
  75.      * Is the node a collection?
  76.      *
  77.      * @return bool
  78.      */
  79.     public function isCollection()
  80.     {
  81.         return $this->collection;
  82.     }
  83.     /**
  84.      * Is the node a prototype?
  85.      *
  86.      * @return bool
  87.      */
  88.     public function isPrototype()
  89.     {
  90.         return $this->prototype;
  91.     }
  92. }