/**
  * @dataProvider rgb2hslProvider
  * @depends testNormalizeRGBValue
  **/
 public function testRgb2hsl($r, $g, $b, $aExpected)
 {
     $aHSL = CSSColorUtils::rgb2hsl($r, $g, $b, $aExpected);
     // assertEquals because hsl2rgb returns an array of floats,
     // even if they are rounded
     $this->assertEquals($aHSL, $aExpected);
 }
 public function toHSL()
 {
     $sName = $this->getName();
     $aComponents = $this->aComponents;
     if (!$sName || $sName == 'hsl') {
         return;
     }
     if ($sName == 'hsla') {
         // If we don't need alpha channel, drop it
         if ($aComponents['a']->getSize() >= 1) {
             unset($this->aComponents['a']);
             $this->setName('hsl');
         }
         return;
     }
     $aHSL = CSSColorUtils::rgb2hsl($aComponents['r']->getSize(), $aComponents['g']->getSize(), $aComponents['b']->getSize(), isset($aComponents['a']) ? $aComponents['a']->getSize() : 1);
     $this->aComponents = array();
     $this->aComponents['h'] = new CSSSize($aHSL['h'], null, true);
     $this->aComponents['s'] = new CSSSize($aHSL['s'], '%', true);
     $this->aComponents['l'] = new CSSSize($aHSL['l'], '%', true);
     $sName = 'hsl';
     if (isset($aHSL['a'])) {
         $this->aComponents['a'] = new CSSSize($aHSL['a'], null, true);
         $sName = 'hsla';
     }
     $this->setName($sName);
     return $this;
 }