<?php
/**
 * Decorator for Actions Column
 * 
 * @author Elze Kool <info@visualmedia.nl>
 */

namespace VisualM\ManagementBundle\AdminList\Column\Decorator;

use VisualM\ManagementBundle\AdminList\Column\ActionsColumn;

/**
 * Decorator for Actions Column
 *
 * @author Elze Kool <info@visualmedia.nl>
 */
class ActionsDecorator implements ColumnDecoratorInterface
{
    /**
     * Width
     * @var string
     */
    private $width;

    /**
     * Column
     * @var ActionsColumn
     */
    private $column;

    /**
     * Constructor
     *
     * @param string        $width  Width
     * @param ActionsColumn $column Column
     */
    public function __construct($width, ActionsColumn $column)
    {
        $this->width = $width;
        $this->column = $column;
    }

    /**
     * {@inheritdoc}
     */
    public function getColumn()
    {
        return $this->column;
    }

    /**
     * {@inheritdoc}
     */
    public function getWidth()
    {
        return $this->width;
    }

    /**
     * {@inheritdoc}
     */
    public function getSpan()
    {
        $span = 0;
        if (count($this->column->getActions()) > 0) {
            $span += 1;
        }
        $span += count($this->column->getPrimaryActions());
        return $span;
    }
    
}