<?php

namespace VisualM\ManagementBundle\AdminList\Column\Decorator;

use VisualM\ManagementBundle\AdminList\Column\OrderActionsColumn;

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

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

    /**
     * Constructor
     *
     * @param string             $width  Width
     * @param OrderActionsColumn $column Column
     */
    public function __construct($width, OrderActionsColumn $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 = count($this->column->getActions());
        if ($span == 0) { $span = 1; }
        return $span;
    }
    
}