PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.5
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.5
6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 All 196 releases
fluentform / app / Services / Spout / Writer / ODS / Helper / BorderHelper.php

BorderHelper.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 6.2.5, at app/Services/Spout/Writer/ODS/Helper/BorderHelper.php

69 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Box\Spout\Writer\ODS\Helper;
4
5 use Box\Spout\Writer\Style\BorderPart;
6 use Box\Spout\Writer\Style\Border;
7
8 /**
9 * Class BorderHelper
10 *
11 * The fo:border, fo:border-top, fo:border-bottom, fo:border-left and fo:border-right attributes
12 * specify border properties
13 * http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1419780_253892949
14 *
15 * Example table-cell-properties
16 *
17 * <style:table-cell-properties
18 * fo:border-bottom="0.74pt solid #ffc000" style:diagonal-bl-tr="none"
19 * style:diagonal-tl-br="none" fo:border-left="none" fo:border-right="none"
20 * style:rotation-align="none" fo:border-top="none"/>
21 */
22 class BorderHelper
23 {
24 /**
25 * Width mappings
26 *
27 * @var array
28 */
29 protected static $widthMap = [
30 Border::WIDTH_THIN => '0.75pt',
31 Border::WIDTH_MEDIUM => '1.75pt',
32 Border::WIDTH_THICK => '2.5pt',
33 ];
34
35 /**
36 * Style mapping
37 *
38 * @var array
39 */
40 protected static $styleMap = [
41 Border::STYLE_SOLID => 'solid',
42 Border::STYLE_DASHED => 'dashed',
43 Border::STYLE_DOTTED => 'dotted',
44 Border::STYLE_DOUBLE => 'double',
45 ];
46
47 /**
48 * @param BorderPart $borderPart
49 * @return string
50 */
51 public static function serializeBorderPart(BorderPart $borderPart)
52 {
53 $definition = 'fo:border-%s="%s"';
54
55 if ($borderPart->getStyle() === Border::STYLE_NONE) {
56 $borderPartDefinition = sprintf($definition, $borderPart->getName(), 'none');
57 } else {
58 $attributes = [
59 self::$widthMap[$borderPart->getWidth()],
60 self::$styleMap[$borderPart->getStyle()],
61 '#' . $borderPart->getColor(),
62 ];
63 $borderPartDefinition = sprintf($definition, $borderPart->getName(), implode(' ', $attributes));
64 }
65
66 return $borderPartDefinition;
67 }
68 }
69