You are here

class Context in Zircon Profile 8

Same name in this branch
  1. 8 vendor/sebastian/recursion-context/src/Context.php \SebastianBergmann\RecursionContext\Context
  2. 8 core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context
  3. 8 core/lib/Drupal/Component/Plugin/Context/Context.php \Drupal\Component\Plugin\Context\Context
  4. 8 vendor/phpdocumentor/reflection-docblock/src/phpDocumentor/Reflection/DocBlock/Context.php \phpDocumentor\Reflection\DocBlock\Context
Same name and namespace in other branches
  1. 8.0 vendor/phpdocumentor/reflection-docblock/src/phpDocumentor/Reflection/DocBlock/Context.php \phpDocumentor\Reflection\DocBlock\Context

The context in which a DocBlock occurs.

@author Vasil Rangelov <boen.robot@gmail.com> @license http://www.opensource.org/licenses/mit-license.php MIT @link http://phpdoc.org

Hierarchy

  • class \phpDocumentor\Reflection\DocBlock\Context

Expanded class hierarchy of Context

5 files declare their use of Context
Collection.php in vendor/phpdocumentor/reflection-docblock/src/phpDocumentor/Reflection/DocBlock/Type/Collection.php
CollectionTest.php in vendor/phpdocumentor/reflection-docblock/tests/phpDocumentor/Reflection/DocBlock/Type/CollectionTest.php
DocBlock.php in vendor/phpdocumentor/reflection-docblock/src/phpDocumentor/Reflection/DocBlock.php
DocBlockTest.php in vendor/phpdocumentor/reflection-docblock/tests/phpDocumentor/Reflection/DocBlockTest.php
TagTest.php in vendor/phpdocumentor/reflection-docblock/tests/phpDocumentor/Reflection/DocBlock/TagTest.php
3 string references to 'Context'
Page::buildOptionsForm in core/modules/views/src/Plugin/views/display/Page.php
Provide a form to edit options for this plugin.
system.schema.yml in core/modules/system/config/schema/system.schema.yml
core/modules/system/config/schema/system.schema.yml
views.display.schema.yml in core/modules/views/config/schema/views.display.schema.yml
core/modules/views/config/schema/views.display.schema.yml

File

vendor/phpdocumentor/reflection-docblock/src/phpDocumentor/Reflection/DocBlock/Context.php, line 22

Namespace

phpDocumentor\Reflection\DocBlock
View source
class Context {

  /** @var string The current namespace. */
  protected $namespace = '';

  /** @var array List of namespace aliases => Fully Qualified Namespace. */
  protected $namespace_aliases = array();

  /** @var string Name of the structural element, within the namespace. */
  protected $lsen = '';

  /**
   * Cteates a new context.
   * @param string $namespace         The namespace where this DocBlock
   *     resides in.
   * @param array  $namespace_aliases List of namespace aliases => Fully
   *     Qualified Namespace.
   * @param string $lsen              Name of the structural element, within
   *     the namespace.
   */
  public function __construct($namespace = '', array $namespace_aliases = array(), $lsen = '') {
    if (!empty($namespace)) {
      $this
        ->setNamespace($namespace);
    }
    $this
      ->setNamespaceAliases($namespace_aliases);
    $this
      ->setLSEN($lsen);
  }

  /**
   * @return string The namespace where this DocBlock resides in.
   */
  public function getNamespace() {
    return $this->namespace;
  }

  /**
   * @return array List of namespace aliases => Fully Qualified Namespace.
   */
  public function getNamespaceAliases() {
    return $this->namespace_aliases;
  }

  /**
   * Returns the Local Structural Element Name.
   *
   * @return string Name of the structural element, within the namespace.
   */
  public function getLSEN() {
    return $this->lsen;
  }

  /**
   * Sets a new namespace.
   *
   * Sets a new namespace for the context. Leading and trailing slashes are
   * trimmed, and the keywords "global" and "default" are treated as aliases
   * to no namespace.
   *
   * @param string $namespace The new namespace to set.
   *
   * @return $this
   */
  public function setNamespace($namespace) {
    if ('global' !== $namespace && 'default' !== $namespace) {

      // Srip leading and trailing slash
      $this->namespace = trim((string) $namespace, '\\');
    }
    else {
      $this->namespace = '';
    }
    return $this;
  }

  /**
   * Sets the namespace aliases, replacing all previous ones.
   *
   * @param array $namespace_aliases List of namespace aliases => Fully
   *     Qualified Namespace.
   *
   * @return $this
   */
  public function setNamespaceAliases(array $namespace_aliases) {
    $this->namespace_aliases = array();
    foreach ($namespace_aliases as $alias => $fqnn) {
      $this
        ->setNamespaceAlias($alias, $fqnn);
    }
    return $this;
  }

  /**
   * Adds a namespace alias to the context.
   *
   * @param string $alias The alias name (the part after "as", or the last
   *     part of the Fully Qualified Namespace Name) to add.
   * @param string $fqnn  The Fully Qualified Namespace Name for this alias.
   *     Any form of leading/trailing slashes are accepted, but what will be
   *     stored is a name, prefixed with a slash, and no trailing slash.
   *
   * @return $this
   */
  public function setNamespaceAlias($alias, $fqnn) {
    $this->namespace_aliases[$alias] = '\\' . trim((string) $fqnn, '\\');
    return $this;
  }

  /**
   * Sets a new Local Structural Element Name.
   *
   * Sets a new Local Structural Element Name. A local name also contains
   * punctuation determining the kind of structural element (e.g. trailing "("
   * and ")" for functions and methods).
   *
   * @param string $lsen The new local name of a structural element.
   *
   * @return $this
   */
  public function setLSEN($lsen) {
    $this->lsen = (string) $lsen;
    return $this;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Context::$lsen protected property @var string Name of the structural element, within the namespace.
Context::$namespace protected property @var string The current namespace.
Context::$namespace_aliases protected property @var array List of namespace aliases => Fully Qualified Namespace.
Context::getLSEN public function Returns the Local Structural Element Name.
Context::getNamespace public function
Context::getNamespaceAliases public function
Context::setLSEN public function Sets a new Local Structural Element Name.
Context::setNamespace public function Sets a new namespace.
Context::setNamespaceAlias public function Adds a namespace alias to the context.
Context::setNamespaceAliases public function Sets the namespace aliases, replacing all previous ones.
Context::__construct public function Cteates a new context.