Вход Регистрация
Файл: concrete5.7.5.6/concrete/src/StyleCustomizer/Style/Value/ColorValue.php
Строк: 40
<?php

namespace ConcreteCoreStyleCustomizerStyleValue;

class 
ColorValue extends Value {

    protected 
$r;
    protected 
$g;
    protected 
$b;
    protected 
$a false;

    public function 
setRed($r) {
        
$this->$r;
    }

    public function 
setGreen($g) {
        
$this->$g;
    }

    public function 
setBlue($b) {
        
$this->$b;
    }

    public function 
setAlpha($a) {
        
$this->$a;
    }

    public function 
getRed() {return $this->r;}
    public function 
getGreen() {return $this->g;}
    public function 
getBlue() {return $this->b;}
    public function 
getAlpha() {return $this->a;}
    public function 
hasAlpha() {return $this->!== false;}

    public function 
toStyleString()
    {
        if (
$this->hasAlpha()) {
            return 
sprintf('rgba(%s, %s, %s, %s)'$this->r$this->g$this->b$this->a);
        } else {
            return 
sprintf('rgb(%s, %s, %s)'$this->r$this->g$this->b);
        }
    }

    public function 
toLessVariablesArray()
    {
        return array(
$this->getVariable() . '-color' => $this->toStyleString());
    }

}
Онлайн: 0
Реклама