FOSSology  4.4.0
Open Source License Compliance by Open Source Software
Upload.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2017, 2020 Siemens AG
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
11 namespace Fossology\UI\Api\Models;
16 class Upload
17 {
22  private $folderId;
27  private $folderName;
32  private $uploadId;
37  private $description;
42  private $uploadName;
47  private $uploadDate;
52  private $assignee;
57  private $assigneeDate;
62  private $closingDate;
67  private $hash;
68 
81  {
82  $this->folderId = intval($folderId);
83  $this->folderName = $folderName;
84  $this->uploadId = intval($uploadId);
85  $this->description = $description;
86  $this->uploadName = $uploadName;
87  $this->uploadDate = $uploadDate;
88  $this->assignee = $assignee == 1 ? null : intval($assignee);
89  $this->assigneeDate = null;
90  $this->closingDate = null;
91  $this->hash = $hash;
92  }
93 
98  public function getJSON($version=ApiVersion::V1)
99  {
100  return json_encode($this->getArray($version));
101  }
102 
107  public function getArray($version=ApiVersion::V1)
108  {
109  if ($version==ApiVersion::V2) {
110  return [
111  "folderId" => $this->folderId,
112  "folderName" => $this->folderName,
113  "id" => $this->uploadId,
114  "description" => $this->description,
115  "uploadName" => $this->uploadName,
116  "uploadDate" => $this->uploadDate,
117  "assignee" => $this->assignee,
118  "assigneeDate" => $this->assigneeDate,
119  "closingDate" => $this->closingDate,
120  "hash" => $this->hash->getArray()
121  ];
122  } else {
123  return [
124  "folderid" => $this->folderId,
125  "foldername" => $this->folderName,
126  "id" => $this->uploadId,
127  "description" => $this->description,
128  "uploadname" => $this->uploadName,
129  "uploaddate" => $this->uploadDate,
130  "assignee" => $this->assignee,
131  "assigneeDate" => $this->assigneeDate,
132  "closingDate" => $this->closingDate,
133  "hash" => $this->hash->getArray()
134  ];
135  }
136  }
137 
142  public function setAssigneeDate(?string $assigneeDate): Upload
143  {
144  $this->assigneeDate = $assigneeDate;
145  return $this;
146  }
147 
152  public function setClosingDate(?string $closingDate): Upload
153  {
154  $this->closingDate = $closingDate;
155  return $this;
156  }
157 }
Model class to hold Upload info.
Definition: Upload.php:17
getJSON($version=ApiVersion::V1)
Definition: Upload.php:98
setAssigneeDate(?string $assigneeDate)
Definition: Upload.php:142
getArray($version=ApiVersion::V1)
Definition: Upload.php:107
setClosingDate(?string $closingDate)
Definition: Upload.php:152
__construct($folderId, $folderName, $uploadId, $description, $uploadName, $uploadDate, $assignee, $hash)
Definition: Upload.php:79