.. include:: /Includes.rst.txt .. _feature-87665: ======================================== Feature: #87665 - Introduce BitSet class ======================================== See :issue:`87665` Description =========== To efficiently handle boolean flags, bit sets can be used. Therefore a new class :php:`\TYPO3\CMS\Core\Type\BitSet` has been introduced. The bit set can be used standalone and accessed from the outside but it can also be used to create specific BitSet classes that extend the BitSet class. The functionality is best described by an example: :: get(PERMISSIONS_PAGE_SHOW); // true $bitSet->get(PERMISSIONS_CONTENT_EDIT); // false Another example shows how to possibly extend the :php:`\TYPO3\CMS\Core\Type\BitSet` class. :: get($permission); } /** * @return bool */ public function hasAllPermissions(): bool { return $this->get(static::ALL); } /** * @param int $permission */ public function allow(int $permission): void { $this->set($permission); } } $permissions = new Permissions(Permissions::PAGE_SHOW | Permissions::PAGE_NEW); $permissions->hasPermission(Permissions::PAGE_SHOW); // true $permissions->hasPermission(Permissions::CONTENT_EDIT); // false Impact ====== This class may come in handy in all situations where boolean flags need to be managed in an efficient way. .. index:: PHP-API, ext:core