code: public function foreachNodes($nodesCollection, array $nodes = array(), array $parentClass = array())
      {
          if (is_object($nodesCollection) === true && $nodesCollection instanceof NodeAbstract) {
              foreach ($nodesCollection->getSubNodeNames() as $subNodeName) {
                  $parentClass[] = $this->getParentClass($nodesCollection);
                  $nodes = $this->fetch($nodesCollection->$subNodeName, $nodes, $parentClass);
              }
          } elseif (is_array($nodesCollection) === true) {
              $nodes = $this->fetch($nodesCollection, $nodes, $parentClass, false);
          }
  
          return $nodes;
      }
docs: @param mixed  $nodesCollection
  @param array  $nodes
  @param string $parentClass
  
  @return array