Initial commit

This commit is contained in:
2020-10-07 10:37:15 +02:00
commit ce5f440392
28157 changed files with 4429172 additions and 0 deletions

View File

@@ -0,0 +1,299 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sensio\Bundle\FrameworkExtraBundle\Configuration;
/**
* The Cache class handles the Cache annotation parts.
*
* @author Fabien Potencier <fabien@symfony.com>
* @Annotation
*/
class Cache extends ConfigurationAnnotation
{
/**
* The expiration date as a valid date for the strtotime() function.
*
* @var string
*/
private $expires;
/**
* The number of seconds that the response is considered fresh by a private
* cache like a web browser.
*
* @var int
*/
private $maxage;
/**
* The number of seconds that the response is considered fresh by a public
* cache like a reverse proxy cache.
*
* @var int
*/
private $smaxage;
/**
* Whether the response is public or not.
*
* @var bool
*/
private $public;
/**
* Whether or not the response must be revalidated.
*
* @var bool
*/
private $mustRevalidate;
/**
* Additional "Vary:"-headers.
*
* @var array
*/
private $vary;
/**
* An expression to compute the Last-Modified HTTP header.
*
* @var string
*/
private $lastModified;
/**
* An expression to compute the ETag HTTP header.
*
* @var string
*/
private $etag;
/**
* max-stale Cache-Control header
* It can be expressed in seconds or with a relative time format (1 day, 2 weeks, ...).
*
* @var int|string
*/
private $maxStale;
/**
* Returns the expiration date for the Expires header field.
*
* @return string
*/
public function getExpires()
{
return $this->expires;
}
/**
* Sets the expiration date for the Expires header field.
*
* @param string $expires A valid php date
*/
public function setExpires($expires)
{
$this->expires = $expires;
}
/**
* Sets the number of seconds for the max-age cache-control header field.
*
* @param int $maxage A number of seconds
*/
public function setMaxAge($maxage)
{
$this->maxage = $maxage;
}
/**
* Returns the number of seconds the response is considered fresh by a
* private cache.
*
* @return int
*/
public function getMaxAge()
{
return $this->maxage;
}
/**
* Sets the number of seconds for the s-maxage cache-control header field.
*
* @param int $smaxage A number of seconds
*/
public function setSMaxAge($smaxage)
{
$this->smaxage = $smaxage;
}
/**
* Returns the number of seconds the response is considered fresh by a
* public cache.
*
* @return int
*/
public function getSMaxAge()
{
return $this->smaxage;
}
/**
* Returns whether or not a response is public.
*
* @return bool
*/
public function isPublic()
{
return true === $this->public;
}
/**
* @return bool
*/
public function mustRevalidate()
{
return true === $this->mustRevalidate;
}
/**
* Forces a response to be revalidated.
*
* @param bool $mustRevalidate
*/
public function setMustRevalidate($mustRevalidate)
{
$this->mustRevalidate = (bool) $mustRevalidate;
}
/**
* Returns whether or not a response is private.
*
* @return bool
*/
public function isPrivate()
{
return false === $this->public;
}
/**
* Sets a response public.
*
* @param bool $public A boolean value
*/
public function setPublic($public)
{
$this->public = (bool) $public;
}
/**
* Returns the custom "Vary"-headers.
*
* @return array
*/
public function getVary()
{
return $this->vary;
}
/**
* Add additional "Vary:"-headers.
*
* @param array $vary
*/
public function setVary($vary)
{
$this->vary = $vary;
}
/**
* Sets the "Last-Modified"-header expression.
*
* @param string $expression
*/
public function setLastModified($expression)
{
$this->lastModified = $expression;
}
/**
* Returns the "Last-Modified"-header expression.
*
* @return string
*/
public function getLastModified()
{
return $this->lastModified;
}
/**
* Sets the "ETag"-header expression.
*
* @param string $expression
*/
public function setEtag($expression)
{
$this->etag = $expression;
}
/**
* Returns the "ETag"-header expression.
*
* @return string
*/
public function getEtag()
{
return $this->etag;
}
/**
* @return int|string
*/
public function getMaxStale()
{
return $this->maxStale;
}
/**
* Sets the number of seconds for the max-stale cache-control header field.
*
* @param int|string $maxStale A number of seconds
*/
public function setMaxStale($maxStale)
{
$this->maxStale = $maxStale;
}
/**
* Returns the annotation alias name.
*
* @return string
*
* @see ConfigurationInterface
*/
public function getAliasName()
{
return 'cache';
}
/**
* Only one cache directive is allowed.
*
* @return bool
*
* @see ConfigurationInterface
*/
public function allowArray()
{
return false;
}
}

View File

@@ -0,0 +1,31 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sensio\Bundle\FrameworkExtraBundle\Configuration;
/**
* Base configuration annotation.
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
abstract class ConfigurationAnnotation implements ConfigurationInterface
{
public function __construct(array $values)
{
foreach ($values as $k => $v) {
if (!method_exists($this, $name = 'set'.$k)) {
throw new \RuntimeException(sprintf('Unknown key "%s" for annotation "@%s".', $k, \get_class($this)));
}
$this->$name($v);
}
}
}

View File

@@ -0,0 +1,34 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sensio\Bundle\FrameworkExtraBundle\Configuration;
/**
* ConfigurationInterface.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
interface ConfigurationInterface
{
/**
* Returns the alias name for an annotated configuration.
*
* @return string
*/
public function getAliasName();
/**
* Returns whether multiple annotations of this type are allowed.
*
* @return bool
*/
public function allowArray();
}

View File

@@ -0,0 +1,29 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sensio\Bundle\FrameworkExtraBundle\Configuration;
/**
* Doctrine-specific ParamConverter with an easier syntax.
*
* @author Ryan Weaver <ryan@knpuniversity.com>
* @Annotation
*/
class Entity extends ParamConverter
{
public function setExpr($expr)
{
$options = $this->getOptions();
$options['expr'] = $expr;
$this->setOptions($options);
}
}

View File

@@ -0,0 +1,107 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sensio\Bundle\FrameworkExtraBundle\Configuration;
/**
* The Security class handles the Security annotation.
*
* @author Ryan Weaver <ryan@knpuniversity.com>
* @Annotation
*/
class IsGranted extends ConfigurationAnnotation
{
/**
* Sets the first argument that will be passed to isGranted().
*
* @var mixed
*/
private $attributes;
/**
* Sets the second argument passed to isGranted().
*
* @var mixed
*/
private $subject;
/**
* The message of the exception - has a nice default if not set.
*
* @var string
*/
private $message;
/**
* If set, will throw Symfony\Component\HttpKernel\Exception\HttpException
* with the given $statusCode.
* If null, Symfony\Component\Security\Core\Exception\AccessDeniedException.
* will be used.
*
* @var int|null
*/
private $statusCode;
public function setAttributes($attributes)
{
$this->attributes = $attributes;
}
public function getAttributes()
{
return $this->attributes;
}
public function setSubject($subject)
{
$this->subject = $subject;
}
public function getSubject()
{
return $this->subject;
}
public function getMessage()
{
return $this->message;
}
public function setMessage($message)
{
$this->message = $message;
}
public function getStatusCode()
{
return $this->statusCode;
}
public function setStatusCode($statusCode)
{
$this->statusCode = $statusCode;
}
public function setValue($value)
{
$this->setAttributes($value);
}
public function getAliasName()
{
return 'is_granted';
}
public function allowArray()
{
return true;
}
}

View File

@@ -0,0 +1,86 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sensio\Bundle\FrameworkExtraBundle\Configuration;
@trigger_error(sprintf('The "%s" annotation is deprecated since version 5.2. Use "%s" instead.', Method::class, \Symfony\Component\Routing\Annotation\Route::class), E_USER_DEPRECATED);
/**
* The Method class handles the Method annotation parts.
*
* @author Fabien Potencier <fabien@symfony.com>
* @Annotation
*
* @deprecated since version 5.2
*/
class Method extends ConfigurationAnnotation
{
/**
* An array of restricted HTTP methods.
*
* @var array
*/
private $methods = [];
/**
* Returns the array of HTTP methods.
*
* @return array
*/
public function getMethods()
{
return $this->methods;
}
/**
* Sets the HTTP methods.
*
* @param array|string $methods An HTTP method or an array of HTTP methods
*/
public function setMethods($methods)
{
$this->methods = \is_array($methods) ? $methods : [$methods];
}
/**
* Sets the HTTP methods.
*
* @param array|string $methods An HTTP method or an array of HTTP methods
*/
public function setValue($methods)
{
$this->setMethods($methods);
}
/**
* Returns the annotation alias name.
*
* @return string
*
* @see ConfigurationInterface
*/
public function getAliasName()
{
return 'method';
}
/**
* Only one method directive is allowed.
*
* @return bool
*
* @see ConfigurationInterface
*/
public function allowArray()
{
return false;
}
}

View File

@@ -0,0 +1,190 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sensio\Bundle\FrameworkExtraBundle\Configuration;
/**
* The ParamConverter class handles the ParamConverter annotation parts.
*
* @author Fabien Potencier <fabien@symfony.com>
* @Annotation
*/
class ParamConverter extends ConfigurationAnnotation
{
/**
* The parameter name.
*
* @var string
*/
private $name;
/**
* The parameter class.
*
* @var string
*/
private $class;
/**
* An array of options.
*
* @var array
*/
private $options = [];
/**
* Whether or not the parameter is optional.
*
* @var bool
*/
private $isOptional = false;
/**
* Use explicitly named converter instead of iterating by priorities.
*
* @var string
*/
private $converter;
/**
* Returns the parameter name.
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Sets the parameter name.
*
* @param string $name The parameter name
*/
public function setValue($name)
{
$this->setName($name);
}
/**
* Sets the parameter name.
*
* @param string $name The parameter name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* Returns the parameter class name.
*
* @return string $name
*/
public function getClass()
{
return $this->class;
}
/**
* Sets the parameter class name.
*
* @param string $class The parameter class name
*/
public function setClass($class)
{
$this->class = $class;
}
/**
* Returns an array of options.
*
* @return array
*/
public function getOptions()
{
return $this->options;
}
/**
* Sets an array of options.
*
* @param array $options An array of options
*/
public function setOptions($options)
{
$this->options = $options;
}
/**
* Sets whether or not the parameter is optional.
*
* @param bool $optional Whether the parameter is optional
*/
public function setIsOptional($optional)
{
$this->isOptional = (bool) $optional;
}
/**
* Returns whether or not the parameter is optional.
*
* @return bool
*/
public function isOptional()
{
return $this->isOptional;
}
/**
* Get explicit converter name.
*
* @return string
*/
public function getConverter()
{
return $this->converter;
}
/**
* Set explicit converter name.
*
* @param string $converter
*/
public function setConverter($converter)
{
$this->converter = $converter;
}
/**
* Returns the annotation alias name.
*
* @return string
*
* @see ConfigurationInterface
*/
public function getAliasName()
{
return 'converters';
}
/**
* Multiple ParamConverters are allowed.
*
* @return bool
*
* @see ConfigurationInterface
*/
public function allowArray()
{
return true;
}
}

View File

@@ -0,0 +1,53 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sensio\Bundle\FrameworkExtraBundle\Configuration;
use Symfony\Component\Routing\Annotation\Route as BaseRoute;
@trigger_error(sprintf('The "%s" annotation is deprecated since version 5.2. Use "%s" instead.', Route::class, BaseRoute::class), E_USER_DEPRECATED);
/**
* @author Kris Wallsmith <kris@symfony.com>
* @Annotation
*
* @deprecated since version 5.2
*/
class Route extends BaseRoute
{
private $service;
public function setService($service)
{
// avoid a BC notice in case of @Route(service="") with sf ^2.7
if (null === $this->getPath()) {
$this->setPath('');
}
$this->service = $service;
}
public function getService()
{
return $this->service;
}
/**
* Multiple route annotations are allowed.
*
* @return bool
*
* @see ConfigurationInterface
*/
public function allowArray()
{
return true;
}
}

View File

@@ -0,0 +1,90 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sensio\Bundle\FrameworkExtraBundle\Configuration;
/**
* The Security class handles the Security annotation.
*
* @author Fabien Potencier <fabien@symfony.com>
* @Annotation
*/
class Security extends ConfigurationAnnotation
{
/**
* The expression evaluated to allow or deny access.
*
* @var string
*/
private $expression;
/**
* If set, will throw Symfony\Component\HttpKernel\Exception\HttpException
* with the given $statusCode.
* If null, Symfony\Component\Security\Core\Exception\AccessDeniedException.
* will be used.
*
* @var int|null
*/
protected $statusCode;
/**
* The message of the exception.
*
* @var string
*/
protected $message = 'Access denied.';
public function getExpression()
{
return $this->expression;
}
public function setExpression($expression)
{
$this->expression = $expression;
}
public function getStatusCode()
{
return $this->statusCode;
}
public function setStatusCode($statusCode)
{
$this->statusCode = $statusCode;
}
public function getMessage()
{
return $this->message;
}
public function setMessage($message)
{
$this->message = $message;
}
public function setValue($expression)
{
$this->setExpression($expression);
}
public function getAliasName()
{
return 'security';
}
public function allowArray()
{
return true;
}
}

View File

@@ -0,0 +1,157 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sensio\Bundle\FrameworkExtraBundle\Configuration;
/**
* The Template class handles the Template annotation parts.
*
* @author Fabien Potencier <fabien@symfony.com>
* @Annotation
*/
class Template extends ConfigurationAnnotation
{
/**
* The template.
*
* @var string
*/
protected $template;
/**
* The associative array of template variables.
*
* @var array
*/
private $vars = [];
/**
* Should the template be streamed?
*
* @var bool
*/
private $streamable = false;
/**
* The controller (+action) this annotation is set to.
*
* @var array
*/
private $owner;
/**
* Returns the array of templates variables.
*
* @return array
*/
public function getVars()
{
return $this->vars;
}
/**
* @param bool $streamable
*/
public function setIsStreamable($streamable)
{
$this->streamable = $streamable;
}
/**
* @return bool
*/
public function isStreamable()
{
return (bool) $this->streamable;
}
/**
* Sets the template variables.
*
* @param array $vars The template variables
*/
public function setVars($vars)
{
$this->vars = $vars;
}
/**
* Sets the template logic name.
*
* @param string $template The template logic name
*/
public function setValue($template)
{
$this->setTemplate($template);
}
/**
* Returns the template.
*
* @return string
*/
public function getTemplate()
{
return $this->template;
}
/**
* Sets the template.
*
* @param string $template The template
*/
public function setTemplate($template)
{
$this->template = $template;
}
/**
* Returns the annotation alias name.
*
* @return string
*
* @see ConfigurationInterface
*/
public function getAliasName()
{
return 'template';
}
/**
* Only one template directive is allowed.
*
* @return bool
*
* @see ConfigurationInterface
*/
public function allowArray()
{
return false;
}
/**
* @param array $owner
*/
public function setOwner(array $owner)
{
$this->owner = $owner;
}
/**
* The controller (+action) this annotation is attached to.
*
* @return array
*/
public function getOwner()
{
return $this->owner;
}
}