| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentCart\OpenSpout\Common\Entity\Style; |
| 4 |
|
| 5 |
class Border |
| 6 |
{ |
| 7 |
public const LEFT = 'left'; |
| 8 |
public const RIGHT = 'right'; |
| 9 |
public const TOP = 'top'; |
| 10 |
public const BOTTOM = 'bottom'; |
| 11 |
public const STYLE_NONE = 'none'; |
| 12 |
public const STYLE_SOLID = 'solid'; |
| 13 |
public const STYLE_DASHED = 'dashed'; |
| 14 |
public const STYLE_DOTTED = 'dotted'; |
| 15 |
public const STYLE_DOUBLE = 'double'; |
| 16 |
public const WIDTH_THIN = 'thin'; |
| 17 |
public const WIDTH_MEDIUM = 'medium'; |
| 18 |
public const WIDTH_THICK = 'thick'; |
| 19 |
/** @var array A list of BorderPart objects for this border. */ |
| 20 |
private $parts = []; |
| 21 |
public function __construct(array $borderParts = []) |
| 22 |
{ |
| 23 |
$this->setParts($borderParts); |
| 24 |
} |
| 25 |
/** |
| 26 |
* @param string $name The name of the border part |
| 27 |
* |
| 28 |
* @return null|BorderPart |
| 29 |
*/ |
| 30 |
public function getPart($name) |
| 31 |
{ |
| 32 |
return $this->hasPart($name) ? $this->parts[$name] : null; |
| 33 |
} |
| 34 |
/** |
| 35 |
* @param string $name The name of the border part |
| 36 |
* |
| 37 |
* @return bool |
| 38 |
*/ |
| 39 |
public function hasPart($name) |
| 40 |
{ |
| 41 |
return isset($this->parts[$name]); |
| 42 |
} |
| 43 |
/** |
| 44 |
* @return array |
| 45 |
*/ |
| 46 |
public function getParts() |
| 47 |
{ |
| 48 |
return $this->parts; |
| 49 |
} |
| 50 |
/** |
| 51 |
* Set BorderParts. |
| 52 |
* |
| 53 |
* @param array $parts |
| 54 |
*/ |
| 55 |
public function setParts($parts) |
| 56 |
{ |
| 57 |
$this->parts = []; |
| 58 |
foreach ($parts as $part) { |
| 59 |
$this->addPart($part); |
| 60 |
} |
| 61 |
} |
| 62 |
/** |
| 63 |
* @return Border |
| 64 |
*/ |
| 65 |
public function addPart(BorderPart $borderPart) |
| 66 |
{ |
| 67 |
$this->parts[$borderPart->getName()] = $borderPart; |
| 68 |
return $this; |
| 69 |
} |
| 70 |
} |
| 71 |
|