FOSSology  4.4.0
Open Source License Compliance by Open Source Software
Types.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2014 Siemens AG
4  Author: J.Najjar
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 
9 namespace Fossology\Lib\Data;
10 
12 
13 class Types
14 {
16  protected $map;
18  protected $name;
19 
20  public function __construct($name)
21  {
22  $this->name = $name;
23  }
24 
30  function getTypeName($type)
31  {
32  if (array_key_exists($type, $this->map)) {
33  return $this->map[$type];
34  }
35  throw new \Exception("unknown " . $this->name . " id " . $type);
36  }
37 
41  public function getMap()
42  {
43  return $this->map;
44  }
45 
49  public function getTypeByName($name)
50  {
51  return array_search($name, $this->map);
52  }
53 }
Fossology exception.
Definition: Exception.php:15