1<?php 2 3/* 4 * This file is part of the league/commonmark package. 5 * 6 * (c) Colin O'Dell <colinodell@gmail.com> 7 * (c) 2015 Martin Hasoň <martin.hason@gmail.com> 8 * 9 * For the full copyright and license information, please view the LICENSE 10 * file that was distributed with this source code. 11 */ 12 13declare(strict_types=1); 14 15namespace League\CommonMark\Extension\Attributes\Node; 16 17use League\CommonMark\Node\Block\AbstractBlock; 18 19final class Attributes extends AbstractBlock 20{ 21 public const TARGET_PARENT = 0; 22 public const TARGET_PREVIOUS = 1; 23 public const TARGET_NEXT = 2; 24 25 /** @var array<string, mixed> */ 26 private array $attributes; 27 28 private int $target = self::TARGET_NEXT; 29 30 /** 31 * @param array<string, mixed> $attributes 32 */ 33 public function __construct(array $attributes) 34 { 35 parent::__construct(); 36 37 $this->attributes = $attributes; 38 } 39 40 /** 41 * @return array<string, mixed> 42 */ 43 public function getAttributes(): array 44 { 45 return $this->attributes; 46 } 47 48 /** 49 * @param array<string, mixed> $attributes 50 */ 51 public function setAttributes(array $attributes): void 52 { 53 $this->attributes = $attributes; 54 } 55 56 public function getTarget(): int 57 { 58 return $this->target; 59 } 60 61 public function setTarget(int $target): void 62 { 63 $this->target = $target; 64 } 65} 66