/**
  * {@inheritdoc}
  */
 public function toArray()
 {
     $array = parent::toArray();
     // ensure we have an object for the reverse_nested key.
     // if we don't have a path, then this would otherwise get encoded as an empty array, which is invalid.
     $array['reverse_nested'] = (object) $array['reverse_nested'];
     return $array;
 }
 /**
  * {@inheritdoc}
  */
 public function toArray()
 {
     $array = parent::toArray();
     $baseName = $this->_getBaseName();
     if (isset($array[$baseName]['script']) && is_array($array[$baseName]['script'])) {
         $script = $array[$baseName]['script'];
         unset($array[$baseName]['script']);
         $array[$baseName] = array_merge($array[$baseName], $script);
     }
     return $array;
 }