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 / XLSX / Helper / BorderHelper.php

BorderHelper.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 6.2.5, at app/Services/Spout/Writer/XLSX/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\XLSX\Helper;
4
5 use Box\Spout\Writer\Style\Border;
6 use Box\Spout\Writer\Style\BorderPart;
7
8 class BorderHelper
9 {
10 public static $xlsxStyleMap = [
11 Border::STYLE_SOLID => [
12 Border::WIDTH_THIN => 'thin',
13 Border::WIDTH_MEDIUM => 'medium',
14 Border::WIDTH_THICK => 'thick'
15 ],
16 Border::STYLE_DOTTED => [
17 Border::WIDTH_THIN => 'dotted',
18 Border::WIDTH_MEDIUM => 'dotted',
19 Border::WIDTH_THICK => 'dotted',
20 ],
21 Border::STYLE_DASHED => [
22 Border::WIDTH_THIN => 'dashed',
23 Border::WIDTH_MEDIUM => 'mediumDashed',
24 Border::WIDTH_THICK => 'mediumDashed',
25 ],
26 Border::STYLE_DOUBLE => [
27 Border::WIDTH_THIN => 'double',
28 Border::WIDTH_MEDIUM => 'double',
29 Border::WIDTH_THICK => 'double',
30 ],
31 Border::STYLE_NONE => [
32 Border::WIDTH_THIN => 'none',
33 Border::WIDTH_MEDIUM => 'none',
34 Border::WIDTH_THICK => 'none',
35 ],
36 ];
37
38 /**
39 * @param BorderPart $borderPart
40 * @return string
41 */
42 public static function serializeBorderPart(BorderPart $borderPart)
43 {
44 $borderStyle = self::getBorderStyle($borderPart);
45
46 $colorEl = $borderPart->getColor() ? sprintf('<color rgb="%s"/>', $borderPart->getColor()) : '';
47 $partEl = sprintf(
48 '<%s style="%s">%s</%s>',
49 $borderPart->getName(),
50 $borderStyle,
51 $colorEl,
52 $borderPart->getName()
53 );
54
55 return $partEl . PHP_EOL;
56 }
57
58 /**
59 * Get the style definition from the style map
60 *
61 * @param BorderPart $borderPart
62 * @return string
63 */
64 protected static function getBorderStyle(BorderPart $borderPart)
65 {
66 return self::$xlsxStyleMap[$borderPart->getStyle()][$borderPart->getWidth()];
67 }
68 }
69