FOSSology  4.4.0
Open Source License Compliance by Open Source Software
FileInfo.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2023 Soham Banerjee <sohambanerjee4abc@hotmail.com>
4  SPDX-License-Identifier: GPL-2.0-only
5 */
6 
12 namespace Fossology\UI\Api\Models;
13 
15 
16 
21 class FileInfo
22 {
27  private $view_info;
28 
33  private $meta_info;
34 
39  private $package_info;
40 
45  private $tag_info;
46 
51  private $reuse_info;
52 
62  {
63  $this->view_info = $view_info;
64  $this->meta_info = $meta_info;
65  $this->package_info = $package_info;
66  $this->tag_info = $tag_info;
67  $this->reuse_info = $reuse_info;
68  }
69 
71 
76  public function getJSON($version=ApiVersion::V1)
77  {
78  return json_encode($this->getArray($version));
79  }
80 
85  public function getArray($version=ApiVersion::V1)
86  {
87  if ($version==ApiVersion::V2) {
88  return array(
89  'viewInfo' => $this->view_info,
90  'metaInfo' => $this->meta_info,
91  'packageInfo' => $this->package_info,
92  'tagInfo' => $this->tag_info,
93  'reuseInfo' => $this->reuse_info
94  );
95  } else {
96  return array(
97  'view_info' => $this->view_info,
98  'meta_info' => $this->meta_info,
99  'package_info' => $this->package_info,
100  'tag_info' => $this->tag_info,
101  'reuse_info' => $this->reuse_info
102  );
103  }
104  }
105 }
FileInfo model to contain general error and return values.
Definition: FileInfo.php:22
__construct($view_info, $meta_info, $package_info, $tag_info, $reuse_info)
Definition: FileInfo.php:61
getJSON($version=ApiVersion::V1)
Definition: FileInfo.php:76
getArray($version=ApiVersion::V1)
Definition: FileInfo.php:85