TYPO3 v15 dev-main snapshot ()
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Extbase\Attribute;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
|
||||
readonly class Authorize
|
||||
{
|
||||
public function __construct(
|
||||
public string|array|null $callback = null,
|
||||
public bool $requireLogin = false,
|
||||
public array $requireGroups = [],
|
||||
) {
|
||||
if ($callback === null && !$requireLogin && $requireGroups === []) {
|
||||
throw new \InvalidArgumentException(
|
||||
'Authorize attribute requires at least one of: callback, requireLogin, or requireGroups',
|
||||
1761287265
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Extbase\Attribute;
|
||||
|
||||
use TYPO3\CMS\Core\Resource\Enum\DuplicationBehavior;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class FileUpload
|
||||
{
|
||||
public function __construct(
|
||||
public readonly array $validation,
|
||||
public readonly string $uploadFolder = '',
|
||||
public readonly bool $addRandomSuffix = true,
|
||||
public readonly bool $createUploadFolderIfNotExist = true,
|
||||
public readonly DuplicationBehavior $duplicationBehavior = DuplicationBehavior::REPLACE,
|
||||
) {}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Extbase\Attribute;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PARAMETER)]
|
||||
class IgnoreValidation {}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Extbase\Attribute\ORM;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class Cascade
|
||||
{
|
||||
/**
|
||||
* Currently, Extbase does only support "remove".
|
||||
*
|
||||
* Other possible cascade operations would be: "persist", "merge", "detach", "refresh", "all"
|
||||
* @see http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/working-with-associations.html#transitive-persistence-cascade-operations
|
||||
*
|
||||
* @param 'remove'|null $value
|
||||
*/
|
||||
public function __construct(public readonly ?string $value = null) {}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Extbase\Attribute\ORM;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class Lazy {}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Extbase\Attribute\ORM;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class Transient {}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Extbase\Attribute;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_METHOD)]
|
||||
readonly class RateLimit
|
||||
{
|
||||
public function __construct(
|
||||
public int $limit = 5,
|
||||
public string $interval = '15 minutes',
|
||||
public string $policy = 'sliding_window',
|
||||
public string $message = ''
|
||||
) {
|
||||
if ($this->limit < 1) {
|
||||
throw new \RuntimeException('Invalid "limit" property for rate limit. Ensure, that the value is greater than 0.', 1771074438);
|
||||
}
|
||||
if ($this->interval === '') {
|
||||
throw new \RuntimeException('Invalid "interval" property for rate limit.', 1771074439);
|
||||
}
|
||||
if ($this->policy === '') {
|
||||
throw new \RuntimeException('Invalid "policy" property for rate limit.', 1771074440);
|
||||
}
|
||||
}
|
||||
|
||||
public function getConfiguration(string $identifier): array
|
||||
{
|
||||
return [
|
||||
'id' => 'extbase-' . $identifier,
|
||||
'policy' => $this->policy,
|
||||
'limit' => $this->limit,
|
||||
'interval' => $this->interval,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Extbase\Attribute;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_PARAMETER | \Attribute::IS_REPEATABLE)]
|
||||
class Validate
|
||||
{
|
||||
/**
|
||||
* @param array<string, mixed> $options
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly string $validator,
|
||||
public readonly array $options = []
|
||||
) {}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$strings = [];
|
||||
$strings[] = $this->validator;
|
||||
|
||||
if (count($this->options) > 0) {
|
||||
$validatorOptionsStrings = [];
|
||||
foreach ($this->options as $optionKey => $optionValue) {
|
||||
$validatorOptionsStrings[] = $optionKey . '=' . $optionValue;
|
||||
}
|
||||
|
||||
$strings[] = '(' . implode(', ', $validatorOptionsStrings) . ')';
|
||||
}
|
||||
|
||||
return trim(implode(' ', $strings));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user