TYPO3 CMS  TYPO3_7-6
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 
128  public function setVersion($version)
129  {
130  $this->version = $version;
131  }
132 
136  public function getDescription()
137  {
138  return $this->description;
139  }
140 
145  public function setDescription($description)
146  {
147  $this->description = $description;
148  }
149 
155  public function getConstraints()
156  {
157  return $this->constraints;
158  }
159 
166  public function getConstraintsByType($constraintType)
167  {
168  if (!isset($this->constraints[$constraintType])) {
169  return [];
170  }
171  return $this->constraints[$constraintType];
172  }
173 
180  public function addConstraint(MetaData\PackageConstraint $constraint)
181  {
182  $this->constraints[$constraint->getConstraintType()][] = $constraint;
183  }
184 }
addConstraint(MetaData\PackageConstraint $constraint)
Definition: MetaData.php:180
getConstraintsByType($constraintType)
Definition: MetaData.php:166