<?php
/**
 * Collection Item
 *
 * @author Elze Kool <info@visualmedia.nl>
 */

namespace VisualM\TagManagerBundle\DataCollector;

use Serializable;

/**
 * Collection Item
 *
 * @author e.kool
 */
final class CollectionItem implements Serializable
{
    /**
     * Name
     * @var string
     */
    private $name;

    /**
     * Type
     * @var string
     */
    private $type;

    /**
     * Contents
     * @var string
     */
    private $contents;

    /**
     * Rendered
     * @var boolean
     */
    private $rendered;

    /**
     * Exceptions
     * @var string
     */
    private $exceptions;

    /**
     * Constructor
     * 
     * @param string $name
     * @param string $type
     * @param string $contents
     * @param string $rendered
     * @param string $exceptions
     */
    public function __construct($name, $type, $contents, $rendered, $exceptions)
    {
        $this->name = $name;
        $this->type = $type;
        $this->contents = $contents;
        $this->rendered = $rendered;
        $this->exceptions = $exceptions;
    }

    function getName()
    {
        return $this->name;
    }

    function getType()
    {
        return $this->type;
    }

    function getContents()
    {
        return $this->contents;
    }

    function getRendered()
    {
        return $this->rendered;
    }

    function getExceptions()
    {
        return $this->exceptions;
    }

    
    /**
     * {@inheritdoc}
     */
    public function serialize()
    {
        return serialize([
            $this->name,
            $this->type,
            $this->contents,
            $this->rendered,
            $this->exceptions
        ]);
    }

    /**
     * {@inheritdoc}
     */
    public function unserialize($serialized)
    {
        list(
            $this->name,
            $this->type,
            $this->contents,
            $this->rendered,
            $this->exceptions
        ) = unserialize($serialized);
    }

}