瀏覽代碼

[Templating] tagged the public @api

Fabien Potencier 14 年之前
父節點
當前提交
5c06b3cfeb

+ 14 - 0
src/Symfony/Component/Templating/DelegatingEngine.php

@@ -15,6 +15,8 @@ namespace Symfony\Component\Templating;
  * DelegatingEngine selects an engine for a given template.
  *
  * @author Fabien Potencier <fabien@symfony.com>
+ *
+ * @api
  */
 class DelegatingEngine implements EngineInterface
 {
@@ -24,6 +26,8 @@ class DelegatingEngine implements EngineInterface
      * Constructor.
      *
      * @param array $engines An array of EngineInterface instances to add
+     *
+     * @api
      */
     public function __construct(array $engines = array())
     {
@@ -43,6 +47,8 @@ class DelegatingEngine implements EngineInterface
      *
      * @throws \InvalidArgumentException if the template does not exist
      * @throws \RuntimeException         if the template cannot be rendered
+     *
+     * @api
      */
     public function render($name, array $parameters = array())
     {
@@ -55,6 +61,8 @@ class DelegatingEngine implements EngineInterface
      * @param mixed $name A template name or a TemplateReferenceInterface instance
      *
      * @return Boolean true if the template exists, false otherwise
+     *
+     * @api
      */
     public function exists($name)
     {
@@ -65,6 +73,8 @@ class DelegatingEngine implements EngineInterface
      * Adds an engine.
      *
      * @param EngineInterface $engine An EngineInterface instance
+     *
+     * @api
      */
     public function addEngine(EngineInterface $engine)
     {
@@ -77,6 +87,8 @@ class DelegatingEngine implements EngineInterface
      * @param mixed $name A template name or a TemplateReferenceInterface instance
      *
      * @return Boolean true if this class supports the given template, false otherwise
+     *
+     * @api
      */
     public function supports($name)
     {
@@ -97,6 +109,8 @@ class DelegatingEngine implements EngineInterface
      * @return EngineInterface The engine
      *
      * @throws \RuntimeException if no engine able to work with the template is found
+     *
+     * @api
      */
     protected function getEngine($name)
     {

+ 8 - 0
src/Symfony/Component/Templating/EngineInterface.php

@@ -27,6 +27,8 @@ namespace Symfony\Component\Templating;
  * the template.
  *
  * @author Fabien Potencier <fabien@symfony.com>
+ *
+ * @api
  */
 interface EngineInterface
 {
@@ -39,6 +41,8 @@ interface EngineInterface
      * @return string The evaluated template as a string
      *
      * @throws \RuntimeException if the template cannot be rendered
+     *
+     * @api
      */
     function render($name, array $parameters = array());
 
@@ -48,6 +52,8 @@ interface EngineInterface
      * @param mixed $name A template name or a TemplateReferenceInterface instance
      *
      * @return Boolean true if the template exists, false otherwise
+     *
+     * @api
      */
     function exists($name);
 
@@ -57,6 +63,8 @@ interface EngineInterface
      * @param mixed $name A template name or a TemplateReferenceInterface instance
      *
      * @return Boolean true if this class supports the given template, false otherwise
+     *
+     * @api
      */
     function supports($name);
 }

+ 6 - 0
src/Symfony/Component/Templating/Helper/Helper.php

@@ -18,6 +18,8 @@ namespace Symfony\Component\Templating\Helper;
  * class that exposes a read-only interface for templates.
  *
  * @author Fabien Potencier <fabien@symfony.com>
+ *
+ * @api
  */
 abstract class Helper implements HelperInterface
 {
@@ -27,6 +29,8 @@ abstract class Helper implements HelperInterface
      * Sets the default charset.
      *
      * @param string $charset The charset
+     *
+     * @api
      */
     public function setCharset($charset)
     {
@@ -37,6 +41,8 @@ abstract class Helper implements HelperInterface
      * Gets the default charset.
      *
      * @return string The default charset
+     *
+     * @api
      */
     public function getCharset()
     {

+ 8 - 0
src/Symfony/Component/Templating/Helper/HelperInterface.php

@@ -15,6 +15,8 @@ namespace Symfony\Component\Templating\Helper;
  * HelperInterface is the interface all helpers must implement.
  *
  * @author Fabien Potencier <fabien@symfony.com>
+ *
+ * @api
  */
 interface HelperInterface
 {
@@ -22,6 +24,8 @@ interface HelperInterface
      * Returns the canonical name of this helper.
      *
      * @return string The canonical name
+     *
+     * @api
      */
     function getName();
 
@@ -29,6 +33,8 @@ interface HelperInterface
      * Sets the default charset.
      *
      * @param string $charset The charset
+     *
+     * @api
      */
     function setCharset($charset);
 
@@ -36,6 +42,8 @@ interface HelperInterface
      * Gets the default charset.
      *
      * @return string The default charset
+     *
+     * @api
      */
     function getCharset();
 }

+ 16 - 0
src/Symfony/Component/Templating/Helper/SlotsHelper.php

@@ -15,6 +15,8 @@ namespace Symfony\Component\Templating\Helper;
  * SlotsHelper manages template slots.
  *
  * @author Fabien Potencier <fabien@symfony.com>
+ *
+ * @api
  */
 class SlotsHelper extends Helper
 {
@@ -30,6 +32,8 @@ class SlotsHelper extends Helper
      * @param string $name  The slot name
      *
      * @throws \InvalidArgumentException if a slot with the same name is already started
+     *
+     * @api
      */
     public function start($name)
     {
@@ -48,6 +52,8 @@ class SlotsHelper extends Helper
      * Stops a slot.
      *
      * @throws \LogicException if no slot has been started
+     *
+     * @api
      */
     public function stop()
     {
@@ -64,6 +70,8 @@ class SlotsHelper extends Helper
      * Returns true if the slot exists.
      *
      * @param string $name The slot name
+     *
+     * @api
      */
     public function has($name)
     {
@@ -77,6 +85,8 @@ class SlotsHelper extends Helper
      * @param string $default The default slot content
      *
      * @return string The slot content
+     *
+     * @api
      */
     public function get($name, $default = false)
     {
@@ -88,6 +98,8 @@ class SlotsHelper extends Helper
      *
      * @param string $name    The slot name
      * @param string $content The slot content
+     *
+     * @api
      */
     public function set($name, $content)
     {
@@ -101,6 +113,8 @@ class SlotsHelper extends Helper
      * @param string $default The default slot content
      *
      * @return Boolean true if the slot is defined or if a default content has been provided, false otherwise
+     *
+     * @api
      */
     public function output($name, $default = false)
     {
@@ -123,6 +137,8 @@ class SlotsHelper extends Helper
      * Returns the canonical name of this helper.
      *
      * @return string The canonical name
+     *
+     * @api
      */
     public function getName()
     {

+ 8 - 0
src/Symfony/Component/Templating/Loader/FilesystemLoader.php

@@ -19,6 +19,8 @@ use Symfony\Component\Templating\TemplateReferenceInterface;
  * FilesystemLoader is a loader that read templates from the filesystem.
  *
  * @author Fabien Potencier <fabien@symfony.com>
+ *
+ * @api
  */
 class FilesystemLoader extends Loader
 {
@@ -28,6 +30,8 @@ class FilesystemLoader extends Loader
      * Constructor.
      *
      * @param array $templatePathPatterns An array of path patterns to look for templates
+     *
+     * @api
      */
     public function __construct($templatePathPatterns)
     {
@@ -40,6 +44,8 @@ class FilesystemLoader extends Loader
      * @param TemplateReferenceInterface $template A template
      *
      * @return Storage|Boolean false if the template cannot be loaded, a Storage instance otherwise
+     *
+     * @api
      */
     public function load(TemplateReferenceInterface $template)
     {
@@ -83,6 +89,8 @@ class FilesystemLoader extends Loader
      *
      * @param TemplateReferenceInterface $template A template
      * @param integer                    $time     The last modification time of the cached template (timestamp)
+     *
+     * @api
      */
     public function isFresh(TemplateReferenceInterface $template, $time)
     {

+ 6 - 0
src/Symfony/Component/Templating/Loader/LoaderInterface.php

@@ -17,6 +17,8 @@ use Symfony\Component\Templating\TemplateReferenceInterface;
  * LoaderInterface is the interface all loaders must implement.
  *
  * @author Fabien Potencier <fabien@symfony.com>
+ *
+ * @api
  */
 interface LoaderInterface
 {
@@ -26,6 +28,8 @@ interface LoaderInterface
      * @param TemplateReferenceInterface $template A template
      *
      * @return Storage|Boolean false if the template cannot be loaded, a Storage instance otherwise
+     *
+     * @api
      */
     function load(TemplateReferenceInterface $template);
 
@@ -34,6 +38,8 @@ interface LoaderInterface
      *
      * @param TemplateReferenceInterface $template A template
      * @param integer                    $time     The last modification time of the cached template (timestamp)
+     *
+     * @api
      */
     function isFresh(TemplateReferenceInterface $template, $time);
 }

+ 42 - 0
src/Symfony/Component/Templating/PhpEngine.php

@@ -21,6 +21,8 @@ use Symfony\Component\Templating\Loader\LoaderInterface;
  * PhpEngine is an engine able to render PHP templates.
  *
  * @author Fabien Potencier <fabien@symfony.com>
+ *
+ * @api
  */
 class PhpEngine implements EngineInterface, \ArrayAccess
 {
@@ -70,6 +72,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
      *
      * @throws \InvalidArgumentException if the template does not exist
      * @throws \RuntimeException         if the template cannot be rendered
+     *
+     * @api
      */
     public function render($name, array $parameters = array())
     {
@@ -105,6 +109,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
      * @param mixed $name A template name or a TemplateReferenceInterface instance
      *
      * @return Boolean true if the template exists, false otherwise
+     *
+     * @api
      */
     public function exists($name)
     {
@@ -123,6 +129,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
      * @param mixed $name A template name or a TemplateReferenceInterface instance
      *
      * @return Boolean true if this class supports the given resource, false otherwise
+     *
+     * @api
      */
     public function supports($name)
     {
@@ -169,6 +177,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
      * @return mixed The helper value
      *
      * @throws \InvalidArgumentException if the helper is not defined
+     *
+     * @api
      */
     public function offsetGet($name)
     {
@@ -181,6 +191,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
      * @param string  $name The helper name
      *
      * @return Boolean true if the helper is defined, false otherwise
+     *
+     * @api
      */
     public function offsetExists($name)
     {
@@ -192,6 +204,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
      *
      * @param HelperInterface $name  The helper instance
      * @param string          $value An alias
+     *
+     * @api
      */
     public function offsetSet($name, $value)
     {
@@ -202,6 +216,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
      * Removes a helper.
      *
      * @param string $name The helper name
+     *
+     * @api
      */
     public function offsetUnset($name)
     {
@@ -210,6 +226,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
 
     /**
      * @param Helper[] $helpers An array of helper
+     *
+     * @api
      */
     public function addHelpers(array $helpers)
     {
@@ -222,6 +240,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
      * Sets the helpers.
      *
      * @params Helper[] $helpers An array of helper
+     *
+     * @api
      */
     public function setHelpers(array $helpers)
     {
@@ -234,6 +254,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
      *
      * @param HelperInterface $helper The helper instance
      * @param string          $alias  An alias
+     *
+     * @api
      */
     public function set(HelperInterface $helper, $alias = null)
     {
@@ -251,6 +273,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
      * @param string  $name The helper name
      *
      * @return Boolean true if the helper is defined, false otherwise
+     *
+     * @api
      */
     public function has($name)
     {
@@ -265,6 +289,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
      * @return HelperInterface The helper instance
      *
      * @throws \InvalidArgumentException if the helper is not defined
+     *
+     * @api
      */
     public function get($name)
     {
@@ -279,6 +305,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
      * Decorates the current template with another one.
      *
      * @param string $template  The decorator logical name
+     *
+     * @api
      */
     public function extend($template)
     {
@@ -292,6 +320,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
      * @param string $context The context name
      *
      * @return string The escaped value
+     *
+     * @api
      */
     public function escape($value, $context = 'html')
     {
@@ -302,6 +332,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
      * Sets the charset to use.
      *
      * @param string $charset The charset
+     *
+     * @api
      */
     public function setCharset($charset)
     {
@@ -312,6 +344,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
      * Gets the current charset.
      *
      * @return string The current charset
+     *
+     * @api
      */
     public function getCharset()
     {
@@ -323,6 +357,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
      *
      * @param string $context The escaper context (html, js, ...)
      * @param mixed  $escaper A PHP callable
+     *
+     * @api
      */
     public function setEscaper($context, $escaper)
     {
@@ -335,6 +371,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
      * @param string $context The context name
      *
      * @return mixed  $escaper A PHP callable
+     *
+     * @api
      */
     public function getEscaper($context)
     {
@@ -348,6 +386,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
     /**
      * @param string $name
      * @param mixed $value
+     *
+     * @api
      */
     public function addGlobal($name, $value)
     {
@@ -358,6 +398,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
      * Returns the assigned globals.
      *
      * @return array
+     *
+     * @api
      */
     public function getGlobals()
     {

+ 4 - 0
src/Symfony/Component/Templating/Storage/FileStorage.php

@@ -15,6 +15,8 @@ namespace Symfony\Component\Templating\Storage;
  * FileStorage represents a template stored on the filesystem.
  *
  * @author Fabien Potencier <fabien@symfony.com>
+ *
+ * @api
  */
 class FileStorage extends Storage
 {
@@ -22,6 +24,8 @@ class FileStorage extends Storage
      * Returns the content of the template.
      *
      * @return string The template content
+     *
+     * @api
      */
     public function getContent()
     {

+ 6 - 0
src/Symfony/Component/Templating/Storage/Storage.php

@@ -15,6 +15,8 @@ namespace Symfony\Component\Templating\Storage;
  * Storage is the base class for all storage classes.
  *
  * @author Fabien Potencier <fabien@symfony.com>
+ *
+ * @api
  */
 abstract class Storage
 {
@@ -24,6 +26,8 @@ abstract class Storage
      * Constructor.
      *
      * @param string $template The template name
+     *
+     * @api
      */
     public function __construct($template)
     {
@@ -44,6 +48,8 @@ abstract class Storage
      * Returns the content of the template.
      *
      * @return string The template content
+     *
+     * @api
      */
     abstract public function getContent();
 }

+ 4 - 0
src/Symfony/Component/Templating/Storage/StringStorage.php

@@ -15,6 +15,8 @@ namespace Symfony\Component\Templating\Storage;
  * StringStorage represents a template stored in a string.
  *
  * @author Fabien Potencier <fabien@symfony.com>
+ *
+ * @api
  */
 class StringStorage extends Storage
 {
@@ -22,6 +24,8 @@ class StringStorage extends Storage
      * Returns the content of the template.
      *
      * @return string The template content
+     *
+     * @api
      */
     public function getContent()
     {

+ 4 - 0
src/Symfony/Component/Templating/TemplateNameParser.php

@@ -21,6 +21,8 @@ use Symfony\Component\Templating\TemplateReference;
  * and the extension for the engine.
  *
  * @author Fabien Potencier <fabien@symfony.com>
+ *
+ * @api
  */
 class TemplateNameParser implements TemplateNameParserInterface
 {
@@ -30,6 +32,8 @@ class TemplateNameParser implements TemplateNameParserInterface
      * @param string $name A template name
      *
      * @return TemplateReferenceInterface A template
+     *
+     * @api
      */
     public function parse($name)
     {

+ 4 - 0
src/Symfony/Component/Templating/TemplateNameParserInterface.php

@@ -16,6 +16,8 @@ namespace Symfony\Component\Templating;
  * instances.
  *
  * @author Fabien Potencier <fabien@symfony.com>
+ *
+ * @api
  */
 interface TemplateNameParserInterface
 {
@@ -25,6 +27,8 @@ interface TemplateNameParserInterface
      * @param string $name A template name
      *
      * @return TemplateReferenceInterface A template
+     *
+     * @api
      */
     function parse($name);
 }

+ 12 - 0
src/Symfony/Component/Templating/TemplateReference.php

@@ -15,6 +15,8 @@ namespace Symfony\Component\Templating;
  * Internal representation of a template.
  *
  * @author Victor Berchet <victor@suumit.com>
+ *
+ * @api
  */
 class TemplateReference implements TemplateReferenceInterface
 {
@@ -42,6 +44,8 @@ class TemplateReference implements TemplateReferenceInterface
      * @return TemplateReferenceInterface The TemplateReferenceInterface instance
      *
      * @throws  \InvalidArgumentException if the parameter is not defined
+     *
+     * @api
      */
     public function set($name, $value)
     {
@@ -62,6 +66,8 @@ class TemplateReference implements TemplateReferenceInterface
      * @return string The parameter value
      *
      * @throws  \InvalidArgumentException if the parameter is not defined
+     *
+     * @api
      */
     public function get($name)
     {
@@ -76,6 +82,8 @@ class TemplateReference implements TemplateReferenceInterface
      * Gets the template parameters.
      *
      * @return array An array of parameters
+     *
+     * @api
      */
     public function all()
     {
@@ -88,6 +96,8 @@ class TemplateReference implements TemplateReferenceInterface
      * By default, it just returns the template name.
      *
      * @return string A path to the template or a resource
+     *
+     * @api
      */
     public function getPath()
     {
@@ -100,6 +110,8 @@ class TemplateReference implements TemplateReferenceInterface
      * The template name acts as a unique identifier for the template.
      *
      * @return string The template name
+     *
+     * @api
      */
     public function getLogicalName()
     {

+ 12 - 0
src/Symfony/Component/Templating/TemplateReferenceInterface.php

@@ -15,6 +15,8 @@ namespace Symfony\Component\Templating;
  * Interface to be implemented by all templates.
  *
  * @author Victor Berchet <victor@suumit.com>
+ *
+ * @api
  */
 interface TemplateReferenceInterface
 {
@@ -22,6 +24,8 @@ interface TemplateReferenceInterface
      * Gets the template parameters.
      *
      * @return array An array of parameters
+     *
+     * @api
      */
     function all();
 
@@ -34,6 +38,8 @@ interface TemplateReferenceInterface
      * @return TemplateReferenceInterface The TemplateReferenceInterface instance
      *
      * @throws  \InvalidArgumentException if the parameter is not defined
+     *
+     * @api
      */
     function set($name, $value);
 
@@ -45,6 +51,8 @@ interface TemplateReferenceInterface
      * @return string The parameter value
      *
      * @throws  \InvalidArgumentException if the parameter is not defined
+     *
+     * @api
      */
     function get($name);
 
@@ -54,6 +62,8 @@ interface TemplateReferenceInterface
      * By default, it just returns the template name.
      *
      * @return string A path to the template or a resource
+     *
+     * @api
      */
     function getPath();
 
@@ -63,6 +73,8 @@ interface TemplateReferenceInterface
      * The template name acts as a unique identifier for the template.
      *
      * @return string The template name
+     *
+     * @api
      */
     function getLogicalName();
 }