<?php
/**
 *
 * This file is part of the Aura project for PHP.
 *
 * @package Aura.Marshal
 *
 * @license http://opensource.org/licenses/bsd-license.php BSD
 *
 */
namespace Aura\Marshal\Collection;

use Aura\Marshal\Type\GenericType;

/**
 *
 * Creates a new collection object for a type.
 *
 * @package Aura.Marshal
 *
 */
class Builder implements BuilderInterface
{
    /**
     *
     * Creates a new collection object.
     *
     * @param array $data Data to load into the collection.
     *
     * @return GenericCollection
     *
     */
    public function newInstance(array $data)
    {
        return new GenericCollection($data);
    }
}

<?php
/**
 *
 * This file is part of the Aura project for PHP.
 *
 * @package Aura.Marshal
 *
 * @license http://opensource.org/licenses/bsd-license.php BSD
 *
 */
namespace Aura\Marshal\Collection;

/**
 *
 * Creates a new collection object for a type.
 *
 * @package Aura.Marshal
 *
 */
class Builder implements BuilderInterface
{
    /**
     *
     * The class to use for new instances.
     *
     * @var string
     *
     */
    protected $class = 'Aura\Marshal\Collection\GenericCollection';

    /**
     *
     * Creates a new collection object.
     *
     * @param array $data Data to load into the collection.
     *
     * @return GenericCollection
     *
     */
    public function newInstance(array $data)
    {
        $class = $this->class;
        return new $class($data);
    }
}

Make collection generic class configurable (just like Entity already is).
Make collection generic class configurable (just like Entity already is).
