-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pipeline.php
543 lines (466 loc) · 9.46 KB
/
Pipeline.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
<?php
class Pipeline_Model_Pipeline
{
protected $_id = null;
protected $_category_id = null;
protected $_path = null;
protected $_full_path = null;
protected $_title = null;
protected $_description = null;
protected $_content_html = null;
protected $_content_markdown = null;
protected $_image = null;
protected $_create_date = null;
protected $_meta_title = null;
protected $_meta_description = null;
protected $_meta_keywords = null;
protected $_active = null;
protected $_sorting = null;
protected $_deleted = null;
protected $_image_draft = null;
protected $_image_table = null;
protected $_gost_name = null;
/**
* @param $options
*/
public function __construct(array $options = null)
{
if (is_array($options))
$this->setOptions($options);
}
/**
* @param $name
* @param $value
* @throws Exception
*/
public function __set($name, $value)
{
$method = 'set' . $name;
if (('mapper' == $name) || !method_exists($this, $method))
throw new Exception('Invalid property (' . $name . ')');
return $this->$method($value);
}
/**
* @param $name
* @throws Exception
*/
public function __get($name)
{
$method = 'get' . $name;
if (('mapper' == $name) || !method_exists($this, $method))
throw new Exception('Invalid property (' . $name . ')');
return $this->$method();
}
/**
* @param $options
* @return $this
*/
public function setOptions(array $options)
{
$methods = get_class_methods($this);
foreach ($options as $key => $value) {
$method = 'set' . ucfirst($key);
if (in_array($method, $methods)) {
$this->$method($value);
}
}
return $this;
}
/**
* @return array|null
*/
public function getOptions()
{
$class = new ReflectionClass($this);
$properties = $class->getProperties(ReflectionProperty::IS_PROTECTED);
if(0 === count($properties))
return null;
$data = array();
foreach ($properties as $property) {
$name = preg_split("~_~", $property->getName());
$normaliseName = implode(array_map("ucwords", $name));
$option = lcfirst($normaliseName);
if ($property->isProtected()) {
$property->setAccessible(TRUE);
$data[$option] = $property->getValue($this);
}
}
return $data;
}
/**
* Set value Id
*
* @return $this
* @param $id
*/
public function setId($id)
{
$this->_id = $id;
return $this;
}
/**
* Get value Id
*
* @return mixed
*/
public function getId()
{
return $this->_id;
}
/**
* Set value CategoryId
*
* @return $this
* @param $category_id
*/
public function setCategoryId($category_id)
{
$this->_category_id = $category_id;
return $this;
}
/**
* Get value CategoryId
*
* @return mixed
*/
public function getCategoryId()
{
return $this->_category_id;
}
/**
* Set value Path
*
* @return $this
* @param $path
*/
public function setPath($path)
{
$this->_path = $path;
return $this;
}
/**
* Get value Path
*
* @return mixed
*/
public function getPath()
{
return $this->_path;
}
/**
* Set value FullPath
*
* @return $this
* @param $full_path
*/
public function setFullPath($full_path)
{
$this->_full_path = $full_path;
return $this;
}
/**
* Get value FullPath
*
* @return mixed
*/
public function getFullPath()
{
return $this->_full_path;
}
/**
* Set value Title
*
* @return $this
* @param $title
*/
public function setTitle($title)
{
$this->_title = $title;
return $this;
}
/**
* Get value Title
*
* @return mixed
*/
public function getTitle()
{
return $this->_title;
}
/**
* Set value Description
*
* @return $this
* @param $description
*/
public function setDescription($description)
{
$this->_description = $description;
return $this;
}
/**
* Get value Description
*
* @return mixed
*/
public function getDescription()
{
return $this->_description;
}
/**
* Set value ContentHtml
*
* @return $this
* @param $content_html
*/
public function setContentHtml($content_html)
{
$this->_content_html = $content_html;
return $this;
}
/**
* Get value ContentHtml
*
* @return mixed
*/
public function getContentHtml()
{
return $this->_content_html;
}
/**
* Set value ContentMarkdown
*
* @return $this
* @param $content_markdown
*/
public function setContentMarkdown($content_markdown)
{
$this->_content_markdown = $content_markdown;
return $this;
}
/**
* Get value ContentMarkdown
*
* @return mixed
*/
public function getContentMarkdown()
{
return $this->_content_markdown;
}
/**
* Set value Image
*
* @return $this
* @param $image
*/
public function setImage($image)
{
$this->_image = $image;
return $this;
}
/**
* Get value Image
*
* @return mixed
*/
public function getImage()
{
return $this->_image;
}
/**
* Set value CreateDate
*
* @return $this
* @param $create_date
*/
public function setCreateDate($create_date)
{
$this->_create_date = $create_date;
return $this;
}
/**
* Get value CreateDate
*
* @return mixed
*/
public function getCreateDate()
{
return $this->_create_date;
}
/**
* Set value MetaTitle
*
* @return $this
* @param $meta_title
*/
public function setMetaTitle($meta_title)
{
$this->_meta_title = $meta_title;
return $this;
}
/**
* Get value MetaTitle
*
* @return mixed
*/
public function getMetaTitle()
{
return $this->_meta_title;
}
/**
* Set value MetaDescription
*
* @return $this
* @param $meta_description
*/
public function setMetaDescription($meta_description)
{
$this->_meta_description = $meta_description;
return $this;
}
/**
* Get value MetaDescription
*
* @return mixed
*/
public function getMetaDescription()
{
return $this->_meta_description;
}
/**
* Set value MetaKeywords
*
* @return $this
* @param $meta_keywords
*/
public function setMetaKeywords($meta_keywords)
{
$this->_meta_keywords = $meta_keywords;
return $this;
}
/**
* Get value MetaKeywords
*
* @return mixed
*/
public function getMetaKeywords()
{
return $this->_meta_keywords;
}
/**
* Set value Active
*
* @return $this
* @param $active
*/
public function setActive($active)
{
$this->_active = $active;
return $this;
}
/**
* Get value Active
*
* @return mixed
*/
public function getActive()
{
return $this->_active;
}
/**
* Set value Sorting
*
* @return $this
* @param $sorting
*/
public function setSorting($sorting)
{
$this->_sorting = $sorting;
return $this;
}
/**
* Get value Sorting
*
* @return mixed
*/
public function getSorting()
{
return $this->_sorting;
}
/**
* Set value Deleted
*
* @return $this
* @param $deleted
*/
public function setDeleted($deleted)
{
$this->_deleted = $deleted;
return $this;
}
/**
* Get value Deleted
*
* @return mixed
*/
public function getDeleted()
{
return $this->_deleted;
}
/**
* Set value ImageDraft
*
* @return $this
* @param $image_draft
*/
public function setImageDraft($image_draft)
{
$this->_image_draft = $image_draft;
return $this;
}
/**
* Get value ImageDraft
*
* @return mixed
*/
public function getImageDraft()
{
return $this->_image_draft;
}
/**
* Set value ImageTable
*
* @return $this
* @param $image_table
*/
public function setImageTable($image_table)
{
$this->_image_table = $image_table;
return $this;
}
/**
* Get value ImageTable
*
* @return mixed
*/
public function getImageTable()
{
return $this->_image_table;
}
/**
* @param null $gost_name
* @return Pipeline_Model_Pipeline
*/
public function setGostName($gost_name)
{
$this->_gost_name = $gost_name;
return $this;
}
/**
* @return null
*/
public function getGostName()
{
return $this->_gost_name;
}
}