/**
  * Convert's the passed DTOs into a JSON-API document representation.
  *
  * @param \AppserverIo\Collections\CollectionInterface $applications The application DTOs to convert
  *
  * @return Tobscure\JsonApi\Document The JSON-API document representation
  */
 protected function toApplicationOverviewData(CollectionInterface $applications)
 {
     // create a new collection of naming directories
     $collection = new Collection($applications->toArray(), new ApplicationSerializer());
     // create a new JSON-API document with that collection as the data
     $document = new Document($collection);
     // add metadata and links
     $document->addMeta('total', count($applications));
     // return the JSON-API representation
     return $document;
 }
 /**
  * Convert's the passed virtual host DTOs into a JSON-API document representation.
  *
  * @param \AppserverIo\Collections\CollectionInterface $virtualHosts The virtual host DTOs to convert
  *
  * @return Tobscure\JsonApi\Document The JSON-API document representation
  */
 protected function toVirtualHostOverviewData(CollectionInterface $virtualHosts)
 {
     // create a new collection of naming directories
     $collection = new Collection($virtualHosts->toArray(), new VirtualHostSerializer());
     // create a new JSON-API document with that collection as the data
     $document = new Document($collection);
     // add metadata and links
     $document->addMeta('total', count($virtualHosts));
     // return the stdClass representation of the naming directories
     return $document;
 }
 /**
  * This method sorts the passed collection depending
  * on the comparator.
  *
  * @param \AppserverIo\Collections\CollectionInterface $collection Holds the Collection that should be sorted
  * @param \AppserverIo\Collections\ComparatorInterface $comperator The Comparator that should be used for compare purposes
  *
  * @return void
  */
 public static function sort(CollectionInterface $collection, ComparatorInterface $comperator)
 {
     // initialize the ArrayList that should be returned
     // sort the ArrayList
     $return = CollectionUtils::arraySort($collection->toArray(), 0, $collection->size(), $comperator);
     // clear all elements and add the sorted
     $collection->clear();
     $collection->addAll($return);
 }
 /**
  * This method merges the elements of the passed map
  * with the elements of the actual map.
  *
  * If the keys are equal, the existing value is taken, else
  * the new one is appended.
  *
  * @param \AppserverIo\Collections\CollectionInterface $col Holds the Collection with the values to merge
  *
  * @return void
  * @deprecated Does not work correctly
  */
 public function merge(CollectionInterface $col)
 {
     // union the items of the two maps
     $this->items = $this->items + $col->toArray();
 }