Example #1
0
 /**
  * @param BorderPart $borderPart
  * @return string
  */
 public static function serializeBorderPart(BorderPart $borderPart)
 {
     $definition = 'fo:border-%s="%s"';
     if ($borderPart->getStyle() === Border::STYLE_NONE) {
         $borderPartDefinition = sprintf($definition, $borderPart->getName(), 'none');
     } else {
         $attributes = [self::$widthMap[$borderPart->getWidth()], self::$styleMap[$borderPart->getStyle()], '#' . $borderPart->getColor()];
         $borderPartDefinition = sprintf($definition, $borderPart->getName(), implode(' ', $attributes));
     }
     return $borderPartDefinition;
 }
Example #2
0
 public function __construct($name)
 {
     $msg = '%s is not a valid name identifier for a border. Valid identifiers are: %s.';
     parent::__construct(sprintf($msg, $name, implode(',', BorderPart::getAllowedNames())));
 }
Example #3
0
 /**
  * Get the style definition from the style map
  *
  * @param BorderPart $borderPart
  * @return string
  */
 protected static function getBorderStyle(BorderPart $borderPart)
 {
     return self::$xlsxStyleMap[$borderPart->getStyle()][$borderPart->getWidth()];
 }