TYPO3 CMS  TYPO3_8-7
MetaData.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Core\Package;
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
21 class MetaData
22 {
23  const CONSTRAINT_TYPE_DEPENDS = 'depends';
24  const CONSTRAINT_TYPE_CONFLICTS = 'conflicts';
25  const CONSTRAINT_TYPE_SUGGESTS = 'suggests';
26 
30  protected static $CONSTRAINT_TYPES = [self::CONSTRAINT_TYPE_DEPENDS, self::CONSTRAINT_TYPE_CONFLICTS, self::CONSTRAINT_TYPE_SUGGESTS];
31 
35  protected $packageKey;
36 
42  protected $packageType;
43 
48  protected $version;
49 
54  protected $title;
55 
60  protected $description;
61 
66  protected $constraints = [];
67 
73  public function getConstraintTypes()
74  {
75  return self::$CONSTRAINT_TYPES;
76  }
77 
83  public function __construct($packageKey)
84  {
85  $this->packageKey = $packageKey;
86  }
87 
91  public function getPackageKey()
92  {
93  return $this->packageKey;
94  }
95 
101  public function getPackageType()
102  {
103  return $this->packageType;
104  }
105 
111  public function setPackageType($packageType)
112  {
113  $this->packageType = $packageType;
114  }
115 
119  public function getVersion()
120  {
121  return $this->version;
122  }
123 
127  public function setVersion($version)
128  {
129  $this->version = $version;
130  }
131 
135  public function getDescription()
136  {
137  return $this->description;
138  }
139 
143  public function setDescription($description)
144  {
145  $this->description = $description;
146  }
147 
153  public function getConstraints()
154  {
155  return $this->constraints;
156  }
157 
164  public function getConstraintsByType($constraintType)
165  {
166  if (!isset($this->constraints[$constraintType])) {
167  return [];
168  }
169  return $this->constraints[$constraintType];
170  }
171 
177  public function addConstraint(MetaData\PackageConstraint $constraint)
178  {
179  $this->constraints[$constraint->getConstraintType()][] = $constraint;
180  }
181 }
addConstraint(MetaData\PackageConstraint $constraint)
Definition: MetaData.php:177
getConstraintsByType($constraintType)
Definition: MetaData.php:164