<commit_before><?php
/**
 * AmChartsPHP
 * 
 * @link      http://github.com/neeckeloo/AmChartsPHP
 * @copyright Copyright (c) 2012 <NAME>
 */
namespace AmCharts\Chart\Setting;

class Background
{
    /**
     * @var Color 
     */
    protected $color;
    
    /**
     * @var Alpha 
     */
    protected $alpha;
    
    /**
     * Constructor
     * 
     * @param string|array|Color $color
     * @param integer $alpha 
     */
    public function __construct($color, $alpha = 100)
    {
        $this->color($color);
        $this->setAlpha($alpha);
    }
    
    /**
     * Sets alpha
     * 
     * @param integer $alpha 
     * @return Background
     */
    public function setAlpha($alpha)
    {
        $this->alpha = new Alpha($alpha);
        
        return $this;
    }
    
    /**
     * Returns alpha
     * 
     * @return integer 
     */
    public function getAlpha()
    {
        return $this->alpha->getOpacity();
    }
        
    /**
     * Sets and returns background color
     *
     * @param string|array|Color $color
     * @return Background
     */
    public function color($color = null)
    {
        if (null !== $color) {
            if ($color instanceof Color) {
                $this->color = $color;
            } else {
                $this->color = new Color($color);
            }
        }

        return $this->color;
    }
    
    /**
     * Returns object properties as array
     * 
     * @return array 
     */
    public function toArray()
    {
        $options = array(
            'backgroundColor' => $this->color,
        );
        
        if (isset($this->alpha)) {
            $options['backgroundAlpha'] = $this->alpha->getValue();
        }
        
        return $options;
    }
}<commit_msg>Bug fix in background class<commit_after><?php
/**
 * AmChartsPHP
 * 
 * @link      http://github.com/neeckeloo/AmChartsPHP
 * @copyright Copyright (c) 2012 <NAME>
 */
namespace AmCharts\Chart\Setting;

class Background
{
    /**
     * @var Color 
     */
    protected $color;
    
    /**
     * @var Alpha 
     */
    protected $alpha;
    
    /**
     * Constructor
     * 
     * @param string|array|Color $color
     * @param integer $alpha 
     */
    public function __construct($color, $alpha = 100)
    {
        $this->color($color);
        $this->setAlpha($alpha);
    }
    
    /**
     * Sets alpha
     * 
     * @param integer $alpha 
     * @return Background
     */
    public function setAlpha($alpha)
    {
        $this->alpha = new Alpha($alpha);
        
        return $this;
    }
    
    /**
     * Returns alpha
     * 
     * @return integer 
     */
    public function getAlpha()
    {
        return $this->alpha->getOpacity();
    }
        
    /**
     * Sets and returns background color
     *
     * @param string|array|Color $color
     * @return Background
     */
    public function color($color = null)
    {
        if (null !== $color) {
            if ($color instanceof Color) {
                $this->color = $color;
            } else {
                $this->color = new Color($color);
            }
        }

        return $this->color;
    }
    
    /**
     * Returns object properties as array
     * 
     * @return array 
     */
    public function toArray()
    {
        $options = array();
        
        if (isset($this->alpha)) {
            $options['backgroundAlpha'] = $this->alpha->getValue();
        }
        if (isset($this->color)) {
            $options['backgroundColor'] = $this->color->toString();
        }
        
        return $options;
    }
}
{'fraction_non_alphanumeric': 0.1363510136073313, 'fraction_numerical': 0.0038878089419605664, 'mean_word_length': 1.460382513661202, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4730841', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1038, 'n_words': 222}