1<?php 2 3declare(strict_types=1); 4 5/* 6 * This is part of the league/commonmark package. 7 * 8 * (c) Martin Hasoň <martin.hason@gmail.com> 9 * (c) Webuni s.r.o. <info@webuni.cz> 10 * (c) Colin O'Dell <colinodell@gmail.com> 11 * 12 * For the full copyright and license information, please view the LICENSE 13 * file that was distributed with this source code. 14 */ 15 16namespace League\CommonMark\Extension\Table; 17 18use League\CommonMark\Block\Element\AbstractBlock; 19use League\CommonMark\Block\Element\AbstractStringContainerBlock; 20use League\CommonMark\Block\Element\InlineContainerInterface; 21use League\CommonMark\ContextInterface; 22use League\CommonMark\Cursor; 23 24final class TableCell extends AbstractStringContainerBlock implements InlineContainerInterface 25{ 26 const TYPE_HEAD = 'th'; 27 const TYPE_BODY = 'td'; 28 29 const ALIGN_LEFT = 'left'; 30 const ALIGN_RIGHT = 'right'; 31 const ALIGN_CENTER = 'center'; 32 33 /** @var string */ 34 public $type = self::TYPE_BODY; 35 36 /** @var string|null */ 37 public $align; 38 39 public function __construct(string $string = '', string $type = self::TYPE_BODY, string $align = null) 40 { 41 parent::__construct(); 42 $this->finalStringContents = $string; 43 $this->addLine($string); 44 $this->type = $type; 45 $this->align = $align; 46 } 47 48 public function canContain(AbstractBlock $block): bool 49 { 50 return false; 51 } 52 53 public function isCode(): bool 54 { 55 return false; 56 } 57 58 public function matchesNextLine(Cursor $cursor): bool 59 { 60 return false; 61 } 62 63 public function handleRemainingContents(ContextInterface $context, Cursor $cursor): void 64 { 65 } 66} 67