| Total Complexity | 3 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class OpenGraphTemplate extends Template |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var \Kerox\Messenger\Model\Message\Attachment\Template\Element\OpenGraphElement[] |
||
| 13 | */ |
||
| 14 | protected $elements = []; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * OpenGraph constructor. |
||
| 18 | * |
||
| 19 | * @param \Kerox\Messenger\Model\Message\Attachment\Template\Element\OpenGraphElement[] $elements |
||
| 20 | * |
||
| 21 | * @throws \InvalidArgumentException |
||
| 22 | */ |
||
| 23 | public function __construct(array $elements) |
||
| 24 | { |
||
| 25 | parent::__construct(); |
||
| 26 | |||
| 27 | $this->isValidArray($elements, 1); |
||
| 28 | |||
| 29 | $this->elements = $elements; |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @param array $elements |
||
| 34 | * |
||
| 35 | * @throws \InvalidArgumentException |
||
| 36 | * |
||
| 37 | * @return \Kerox\Messenger\Model\Message\Attachment\Template\OpenGraphTemplate |
||
| 38 | */ |
||
| 39 | public static function create(array $elements): self |
||
| 40 | { |
||
| 41 | return new self($elements); |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @return array |
||
| 46 | */ |
||
| 47 | public function toArray(): array |
||
| 58 | } |
||
| 59 | } |
||
| 60 |