Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
page.php
1<?php
2
4
5class Page
6{
7 protected $data;
8
12 public function __construct(array $data = [])
13 {
14 $this->prepareData($data);
15 }
16
20 public function toArray()
21 {
22 return $this->data;
23 }
24
28 public function getId()
29 {
30 return $this->data['id'];
31 }
32
36 public function getName()
37 {
38 return $this->data['name'];
39 }
40
44 public function getAbout()
45 {
46 return $this->data['about'];
47 }
48
52 public function getImage()
53 {
54 return $this->data['image'];
55 }
56
60 public function getPhone()
61 {
62 return $this->data['phone'];
63 }
64
68 public function getEmail()
69 {
70 return $this->data['email'];
71 }
72
76 protected function prepareData(array $data)
77 {
78 $this->data = [
79 'id' => 0,
80 'name' => null,
81 'about' => null,
82 'image' => null,
83 'phone' => null,
84 'email' => null,
85 ];
86
87 $this->data = array_merge($this->data, $data);
88 }
89}