Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
   1  <?php
   2  
   3  namespace Box\Spout\Common\Entity\Style;
   4  
   5  /**
   6   * Class Border
   7   */
   8  class Border
   9  {
  10      const LEFT = 'left';
  11      const RIGHT = 'right';
  12      const TOP = 'top';
  13      const BOTTOM = 'bottom';
  14  
  15      const STYLE_NONE = 'none';
  16      const STYLE_SOLID = 'solid';
  17      const STYLE_DASHED = 'dashed';
  18      const STYLE_DOTTED = 'dotted';
  19      const STYLE_DOUBLE = 'double';
  20  
  21      const WIDTH_THIN = 'thin';
  22      const WIDTH_MEDIUM = 'medium';
  23      const WIDTH_THICK = 'thick';
  24  
  25      /** @var array A list of BorderPart objects for this border. */
  26      private $parts = [];
  27  
  28      /**
  29       * @param array $borderParts
  30       */
  31      public function __construct(array $borderParts = [])
  32      {
  33          $this->setParts($borderParts);
  34      }
  35  
  36      /**
  37       * @param string $name The name of the border part
  38       * @return BorderPart|null
  39       */
  40      public function getPart($name)
  41      {
  42          return $this->hasPart($name) ? $this->parts[$name] : null;
  43      }
  44  
  45      /**
  46       * @param string $name The name of the border part
  47       * @return bool
  48       */
  49      public function hasPart($name)
  50      {
  51          return isset($this->parts[$name]);
  52      }
  53  
  54      /**
  55       * @return array
  56       */
  57      public function getParts()
  58      {
  59          return $this->parts;
  60      }
  61  
  62      /**
  63       * Set BorderParts
  64       * @param array $parts
  65       * @return void
  66       */
  67      public function setParts($parts)
  68      {
  69          unset($this->parts);
  70          foreach ($parts as $part) {
  71              $this->addPart($part);
  72          }
  73      }
  74  
  75      /**
  76       * @param BorderPart $borderPart
  77       * @return Border
  78       */
  79      public function addPart(BorderPart $borderPart)
  80      {
  81          $this->parts[$borderPart->getName()] = $borderPart;
  82  
  83          return $this;
  84      }
  85  }