| 1 |
<?php |
| 2 |
|
| 3 |
namespace Box\Spout\Writer\Style; |
| 4 |
|
| 5 |
/** |
| 6 |
* Class BorderBuilder |
| 7 |
*/ |
| 8 |
class BorderBuilder |
| 9 |
{ |
| 10 |
/** |
| 11 |
* @var Border |
| 12 |
*/ |
| 13 |
protected $border; |
| 14 |
|
| 15 |
public function __construct() |
| 16 |
{ |
| 17 |
$this->border = new Border(); |
| 18 |
} |
| 19 |
|
| 20 |
/** |
| 21 |
* @param string|void $color Border A RGB color code |
| 22 |
* @param string|void $width Border width @see BorderPart::allowedWidths |
| 23 |
* @param string|void $style Border style @see BorderPart::allowedStyles |
| 24 |
* @return BorderBuilder |
| 25 |
*/ |
| 26 |
public function setBorderTop($color = Color::BLACK, $width = Border::WIDTH_MEDIUM, $style = Border::STYLE_SOLID) |
| 27 |
{ |
| 28 |
$this->border->addPart(new BorderPart(Border::TOP, $color, $width, $style)); |
| 29 |
return $this; |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* @param string|void $color Border A RGB color code |
| 34 |
* @param string|void $width Border width @see BorderPart::allowedWidths |
| 35 |
* @param string|void $style Border style @see BorderPart::allowedStyles |
| 36 |
* @return BorderBuilder |
| 37 |
*/ |
| 38 |
public function setBorderRight($color = Color::BLACK, $width = Border::WIDTH_MEDIUM, $style = Border::STYLE_SOLID) |
| 39 |
{ |
| 40 |
$this->border->addPart(new BorderPart(Border::RIGHT, $color, $width, $style)); |
| 41 |
return $this; |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* @param string|void $color Border A RGB color code |
| 46 |
* @param string|void $width Border width @see BorderPart::allowedWidths |
| 47 |
* @param string|void $style Border style @see BorderPart::allowedStyles |
| 48 |
* @return BorderBuilder |
| 49 |
*/ |
| 50 |
public function setBorderBottom($color = Color::BLACK, $width = Border::WIDTH_MEDIUM, $style = Border::STYLE_SOLID) |
| 51 |
{ |
| 52 |
$this->border->addPart(new BorderPart(Border::BOTTOM, $color, $width, $style)); |
| 53 |
return $this; |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* @param string|void $color Border A RGB color code |
| 58 |
* @param string|void $width Border width @see BorderPart::allowedWidths |
| 59 |
* @param string|void $style Border style @see BorderPart::allowedStyles |
| 60 |
* @return BorderBuilder |
| 61 |
*/ |
| 62 |
public function setBorderLeft($color = Color::BLACK, $width = Border::WIDTH_MEDIUM, $style = Border::STYLE_SOLID) |
| 63 |
{ |
| 64 |
$this->border->addPart(new BorderPart(Border::LEFT, $color, $width, $style)); |
| 65 |
return $this; |
| 66 |
} |
| 67 |
|
| 68 |
/** |
| 69 |
* @return Border |
| 70 |
*/ |
| 71 |
public function build() |
| 72 |
{ |
| 73 |
return $this->border; |
| 74 |
} |
| 75 |
} |
| 76 |
|