|
9 | 9 | use PHPCensor\Common\Exception\InvalidArgumentException; |
10 | 10 | use PHPCensor\Model; |
11 | 11 | use PHPCensor\Store\BuildStore; |
| 12 | +use PHPCensor\Traits\Model\HasCreateDateTrait; |
| 13 | +use PHPCensor\Traits\Model\HasUserIdTrait; |
12 | 14 |
|
13 | 15 | /** |
14 | 16 | * @package PHP Censor |
|
19 | 21 | */ |
20 | 22 | class Build extends Model |
21 | 23 | { |
| 24 | + use HasUserIdTrait; |
| 25 | + use HasCreateDateTrait; |
| 26 | + |
22 | 27 | public const STATUS_PENDING = 0; |
23 | 28 | public const STATUS_RUNNING = 1; |
24 | 29 | public const STATUS_SUCCESS = 2; |
@@ -300,36 +305,6 @@ public function setTag(?string $value) |
300 | 305 | return $this->setModified('tag'); |
301 | 306 | } |
302 | 307 |
|
303 | | - /** |
304 | | - * @return DateTime|null |
305 | | - * |
306 | | - * @throws Exception |
307 | | - */ |
308 | | - public function getCreateDate() |
309 | | - { |
310 | | - if ($this->data['create_date']) { |
311 | | - return new DateTime($this->data['create_date']); |
312 | | - } |
313 | | - |
314 | | - return null; |
315 | | - } |
316 | | - |
317 | | - /** |
318 | | - * @return bool |
319 | | - */ |
320 | | - public function setCreateDate(DateTime $value) |
321 | | - { |
322 | | - $stringValue = $value->format('Y-m-d H:i:s'); |
323 | | - |
324 | | - if ($this->data['create_date'] === $stringValue) { |
325 | | - return false; |
326 | | - } |
327 | | - |
328 | | - $this->data['create_date'] = $stringValue; |
329 | | - |
330 | | - return $this->setModified('create_date'); |
331 | | - } |
332 | | - |
333 | 308 | /** |
334 | 309 | * @return DateTime|null |
335 | 310 | * |
@@ -521,28 +496,6 @@ public function setSource(?int $value) |
521 | 496 | return $this->setModified('source'); |
522 | 497 | } |
523 | 498 |
|
524 | | - /** |
525 | | - * @return int|null |
526 | | - */ |
527 | | - public function getUserId() |
528 | | - { |
529 | | - return (null !== $this->data['user_id']) ? (int)$this->data['user_id'] : null; |
530 | | - } |
531 | | - |
532 | | - /** |
533 | | - * @return bool |
534 | | - */ |
535 | | - public function setUserId(?int $value) |
536 | | - { |
537 | | - if ($this->data['user_id'] === $value) { |
538 | | - return false; |
539 | | - } |
540 | | - |
541 | | - $this->data['user_id'] = $value; |
542 | | - |
543 | | - return $this->setModified('user_id'); |
544 | | - } |
545 | | - |
546 | 499 | /** |
547 | 500 | * @return int |
548 | 501 | * |
|
0 commit comments