type = $type; $this->embedStyle = false; } /*! * desc * * @method _initCall * @private * @param str $uri the web service uri * @return $curl instance */ private function format($value, $color=null) { if ($this->type == self::TYPE_HTML) { $tag = $color === false ? '' : (is_null($color) ? '' : ''); $content = $tag . $value; } else { $tag = $color === false ? '' : (is_null($color) ? "\033[0m" : "\033[1;3".$color."m" ); $content = $tag . $value; } return $content; } /*! * @method getHtmlClass * @private * @param int $idColor * @return str */ public function embedStyleIfNeeded() { $style = ''; if (!$this->embedStyle) { $this->embedStyle = true; $style .= ''; } return $style; } /*! * @method writeTags * @private * @param [] $tags */ public function writeTags($tags) { $content = ''; foreach($tags as $tag) { if (!empty($tag)) { if (is_array($tag)) { $content .= $this->format($tag[0], count($tag) > 1 ? $tag[1] : null); } elseif (is_string($tag)) { $content .= $this->format($tag); } } } $this->write($content); } /*! * @method write * @private * @param str $value * @param bool $newline * @return str */ private function write($value, $newline=true) { $content = $value . ($newline ? self::LF : ''); if ($this->type == self::TYPE_HTML) { $content = $this->embedStyleIfNeeded() . '
'.$content.'
'; } echo $content; } }