http://stackoverflow.com/questions/12918586/phpexcel-specific-cell-formatting-from-style-object

@param array $style

@return array
773587
public function buildRowStyle(array $style)
    {
        $finalStyleArray   = [];
        $defaultStyleArray = [
            'alignment' => [
                'horizontal' => Alignment::HORIZONTAL_LEFT,
            ],
            'font'      => [
                'color' => [
                    'rgb' => BuilderInterface::COLOUR_BLACK_RGB,
                ],
                'bold' => true,
            ],
            'fill'      => [
                'type'  => Fill::FILL_SOLID,
                'color' => [
                    'rgb' => '000000',
                ],
            ],
        ];

        if (!array_key_exists('alignment', $style)) {
            $finalStyleArray['alignment']['horizontal'] = $defaultStyleArray['alignment']['horizontal'];
        } else {
            switch ($style['alignment']) {
                case 'right':
                    $finalStyleArray['alignment']['horizontal'] = Alignment::HORIZONTAL_RIGHT;

                    break;

                case 'centre':
                case 'center':
                    $finalStyleArray['alignment']['horizontal'] = Alignment::HORIZONTAL_CENTER;

                    break;

                case 'left':
                default:
                    $finalStyleArray['alignment']['horizontal'] = Alignment::HORIZONTAL_LEFT;

                    break;
            }
        }

        if (!array_key_exists('font', $style)) {
            $finalStyleArray['font'] = $defaultStyleArray['font'];
        } else {
            $finalStyleArray['font'] = $style['font'];
        }

        return $finalStyleArray;
    }
826012
public function format($text = '', string $style = 'none')
    {
        return $this->getStartMark($style) . $text . $this->getClearMark();
    }
658510
private function formatRule($rules)
    {
        if (is_array($rules)) {
            foreach ($rules as $rule) {
                $formatted[] = $this->formatRule($rule);
            }

            return $formatted ?? [];
        }

        if (is_object($rules) || is_callable($rules)) {
            return $rules;
        }

        if (Str::contains($rules, 'required_if') && preg_match('/(.*):(.*),(.*)/', $rules, $matches)) {
            $column = Str::startsWith($matches[2], '*.') ? $matches[2] : '*.' . $matches[2];

            return $matches[1] . ':' . $column . ',' . $matches[3];
        }

        return $rules;
    }
1119653
public function setStyle($style) {
		$this->owner->ButtonStyle = trim(strtolower($style));
		return $this->owner;
	}
79985
public function render(array $style)
    {
        $result = [];

        if (isset($style['feature'])) {
            $result[] = $this->renderStyle('feature', $style['feature']);
        }

        if (isset($style['element'])) {
            $result[] = $this->renderStyle('element', $style['element']);
        }

        foreach ($style['rules'] as $rule => $value) {
            $result[] = $this->renderStyle($rule, $value);
        }

        return implode('|', $result);
    }
292723
public function parseStylesheet($stylesheet)
    {
        $parsed = array();
        $stylesheet = $this->_stripStylesheet($stylesheet);
        $stylesheet = trim(trim($stylesheet), "}");
        foreach(explode("}", $stylesheet) as $rule) {
            //Don't parse empty rules
        	if(!trim($rule))continue;
        	list($selector, $style) = explode("{", $rule, 2);
            foreach (explode(',', $selector) as $sel) {
                $parsed[] = array(trim($sel), trim(trim($style), ";"));
            }
        }

        return $parsed;
    }
457927
private function getStyles(Column\AbstractColumn $col)
    {
        $styleFormatter = [];

        /*
         * First all based on value (only one works) @todo
         */
        foreach ($col->getStyles() as $style) {
            $prepend = '';
            $append = '';

            /* @var $style Column\Style\AbstractStyle */
            foreach ($style->getByValues() as $rule) {
                $colString = $rule['column']->getUniqueId();
                switch ($rule['operator']) {
                    case Filter::EQUAL:
                        $operator = '==';
                        break;

                    case Filter::NOT_EQUAL:
                        $operator = '!=';
                        break;

                    default:
                        throw new \Exception('Currently not supported filter operation: "'.$rule['operator'].'"');
                }

                $prepend = 'if (rowObject.'.$colString.' '.$operator.' \''.$rule['value'].'\') {';
                $append .= '}';
            }

            $styleString = '';
            switch (get_class($style)) {
                case Column\Style\Bold::class:
                    $styleString = self::STYLE_BOLD;
                    break;

                case Column\Style\Italic::class:
                    $styleString = self::STYLE_ITALIC;
                    break;

                case Column\Style\Strikethrough::class:
                    $styleString = self::STYLE_STRIKETHROUGH;
                    break;

                case Column\Style\Color::class:
                    $styleString = sprintf(
                        'cellvalue = \'<span style="color: #%s;">\' + cellvalue + \'</span>\';',
                        $style->getRgbHexString()
                    );
                    break;

                case Column\Style\CSSClass::class:
                    $styleString = 'cellvalue = \'<span class="'.$style->getClass().'">\' + cellvalue + \'</span>\';';
                    break;

                case Column\Style\BackgroundColor::class:
                    // do NOTHING! this is done by loadComplete event...
                    // At this stage jqgrid haven't created the columns...
                    break;

                case Column\Style\Html::class:
                    // do NOTHING! just pass the HTML!
                    break;

                case Column\Style\Align::class:
                    // do NOTHING! we have to add the align style in the gridcell and not in a span!
                    break;

                default:
                    throw new \Exception('Not defined style: "'.get_class($style).'"');
                    break;
            }

            $styleFormatter[] = $prepend.$styleString.$append;
        }

        return $styleFormatter;
    }
278573
public function name($name, $style='none')
	{
		if (!is_array($style))
		{
			$style = array('style' => $style);
		}

		return $this->render(
			$this->byName($name),
			$style
		);
	}
798750
public function getStyle(string $s): array
    {
        if (!isset($this->styles[$s])) {
            return current($this->styles);
        }

        return $this->styles[$s];
    }
21509
public function stylesheets(string $collection, ?string $format = null) : string {
        return $this->serve($collection, 'stylesheets', $format);
    }
1287848
public function getTemplatesByPattern($pattern)
    {
        $templates = array();
        foreach ($this->manageableExt->keys() as $ext) {
            $templates = array_merge($templates, parent::getTemplatesByPattern($pattern.$ext));
        }

        return $templates;
    }
426229
public function getStyles($names = [])
    {
        $styles = [];
        
        foreach ($names as $name) {
            $styles[] = $this->getStyle($name);
        }
        
        return array_filter($styles);
    }
863441
public function getStyle(string $s): array
    {
        if (!isset($this->wt_report->styles[$s])) {
            $s                           = $this->getCurrentStyle();
            $this->wt_report->styles[$s] = $s;
        }

        return $this->wt_report->styles[$s];
    }
656951
private function _createCSSStyle(PHPExcel_Style $pStyle) {
		// Construct CSS
		$css = '';

		// Create CSS
		$css = array_merge(
			$this->_createCSSStyleAlignment($pStyle->getAlignment())
			, $this->_createCSSStyleBorders($pStyle->getBorders())
			, $this->_createCSSStyleFont($pStyle->getFont())
			, $this->_createCSSStyleFill($pStyle->getFill())
		);

		// Return
		return $css;
	}
651851
function make_styles_string($styles) {
        if (empty($styles)) {
            return null;
        }

        $string = '';
        foreach($styles as $property => $value) {
            $string .= $property . ':' . $value . ';';
        }
        return $string;
    }
852208
public static function style(string $name, array $style)
    {
        $allow = ['fg' => true, 'bg' => true, 'bold' => true];
        $style = \array_intersect_key($style, $allow);

        if (empty($style)) {
            throw new InvalidArgumentException('Trying to set empty or invalid style');
        }

        if (isset(static::$styles[$name]) || \method_exists(static::class, $name)) {
            throw new InvalidArgumentException('Trying to define existing style');
        }

        static::$styles[$name] = $style;
    }
258706
public function setCellStyle($cellName, array $style)
    {
        //check whether worksheet name is set or not
        if ($this->worksheetName == '')
            throw new Exception('Worksheet name not specified');
        $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
            '/worksheets/' . $this->worksheetName . '/cells/' . $cellName . '/style';
        $jsonArray = json_encode($style);
        $signedURI = Utils::sign($strURI);
        $responseStream = Utils::processCommand($signedURI, 'POST', 'json', $jsonArray);
        $json = json_decode($responseStream);
        if ($json->Code == 200)
            return true;
        else
            return false;

    }