Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Base.php

class Base

Base class for formatters, all the formatters must extend this class.

@author Marco Marchiò <marco.mm89@gmail.com>

@abstract

Hierarchy

  • class \Peast\Formatter\Base

Expanded class hierarchy of Base

6 string references to 'Base'
SqlContentEntityStorage::buildQuery in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Builds the query to load the entity.
UnroutedUrlAssembler::assemble in core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php
This is a helper function that calls buildExternalUrl() or buildLocalUrl() based on a check of whether the path is a valid external URL.
Url::fromUri in core/lib/Drupal/Core/Url.php
Creates a new Url object from a URI.
ViewsDataHelper::fetchFields in core/modules/views/src/ViewsDataHelper.php
Fetches a list of all fields available for a given base type.
WorkspaceAssociation::getAssociatedInitialRevisions in core/modules/workspaces/src/WorkspaceAssociation.php

... See full list

File

vendor/mck89/peast/lib/Peast/Formatter/Base.php, line 19

Namespace

Peast\Formatter
View source
abstract class Base {
    
    /**
     * New line character
     * 
     * @var string
     */
    protected $newLine = "\n";
    
    /**
     * Indentation character
     * 
     * @var string
     */
    protected $indentation = "\t";
    
    /**
     * Boolean that indicates if open curly brackets in code blocks must be
     * on a new line
     * 
     * @var bool
     */
    protected $newLineBeforeCurlyBracket = false;
    
    /**
     * Boolean that indicates if blocks of code must be wrapped in curly
     * brackets also if they contain only one instruction
     * 
     * @var bool
     */
    protected $alwaysWrapBlocks = true;
    
    /**
     * Boolean that indicates if operators must be surrounded by spaces
     * 
     * @var bool
     */
    protected $spacesAroundOperators = true;
    
    /**
     * Boolean that indicates if content inside round brackets must be
     * surrounded by spaces
     * 
     * @var bool
     */
    protected $spacesInsideRoundBrackets = false;
    
    /**
     * Boolean that indicates if comments must be rendered
     * 
     * @var bool
     */
    protected $renderComments = true;
    
    /**
     * Boolean that indicates if multiline documentation comments
     * (for example JSDoc syntax) must be manipulated to match the
     * right indentation
     * 
     * @var bool
     */
    protected $recalcCommentsIndent = true;
    
    /**
     * Class constructor
     *
     * @param bool  $renderComments     True to render the comments if
     *                                  the parser has collected them
     *                                  and the formatter allows their
     *                                  rendering
     */
    public function __construct($renderComments = false) {
        if ($this->renderComments) {
            $this->renderComments = $renderComments;
        }
    }
    
    /**
     * Returns the new line character
     * 
     * @return string
     */
    public function getNewLine() {
        return $this->newLine;
    }
    
    /**
     * Returns the indentation character
     * 
     * @return string
     */
    public function getIndentation() {
        return $this->indentation;
    }
    
    /**
     * Returns a boolean that indicates if open curly brackets in code blocks
     * must be on a new line
     * 
     * @return bool
     */
    public function getNewLineBeforeCurlyBracket() {
        return $this->newLineBeforeCurlyBracket;
    }
    
    /**
     * Returns a boolean that indicates if blocks of code must be wrapped in
     * curly brackets also if they contain only one instruction
     * 
     * @return bool
     */
    public function getAlwaysWrapBlocks() {
        return $this->alwaysWrapBlocks;
    }
    
    /**
     * Returns a boolean that indicates if operators must be surrounded by
     * spaces
     * 
     * @return bool
     */
    public function getSpacesAroundOperator() {
        return $this->spacesAroundOperators;
    }
    
    /**
     * Returns a boolean that indicates if content inside round brackets must be
     * surrounded by spaces
     * 
     * @return bool
     */
    public function getSpacesInsideRoundBrackets() {
        return $this->spacesInsideRoundBrackets;
    }
    
    /**
     * Returns a boolean that indicates if comments must be rendered
     * 
     * @return bool
     */
    public function getRenderComments() {
        return $this->renderComments;
    }
    
    /**
     * Returns a boolean that indicates if multiline documentation comments
     * (for example JSDoc syntax) must be manipulated to match the
     * right indentation
     * 
     * @return bool
     */
    public function getRecalcCommentsIndent() {
        return $this->recalcCommentsIndent;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overrides
Base::$alwaysWrapBlocks protected property Boolean that indicates if blocks of code must be wrapped in curly
brackets also if they contain only one instruction
1
Base::$indentation protected property Indentation character 1
Base::$newLine protected property New line character 1
Base::$newLineBeforeCurlyBracket protected property Boolean that indicates if open curly brackets in code blocks must be
on a new line
1
Base::$recalcCommentsIndent protected property Boolean that indicates if multiline documentation comments
(for example JSDoc syntax) must be manipulated to match the
right indentation
Base::$renderComments protected property Boolean that indicates if comments must be rendered 1
Base::$spacesAroundOperators protected property Boolean that indicates if operators must be surrounded by spaces 1
Base::$spacesInsideRoundBrackets protected property Boolean that indicates if content inside round brackets must be
surrounded by spaces
1
Base::getAlwaysWrapBlocks public function Returns a boolean that indicates if blocks of code must be wrapped in
curly brackets also if they contain only one instruction
Base::getIndentation public function Returns the indentation character
Base::getNewLine public function Returns the new line character
Base::getNewLineBeforeCurlyBracket public function Returns a boolean that indicates if open curly brackets in code blocks
must be on a new line
Base::getRecalcCommentsIndent public function Returns a boolean that indicates if multiline documentation comments
(for example JSDoc syntax) must be manipulated to match the
right indentation
Base::getRenderComments public function Returns a boolean that indicates if comments must be rendered
Base::getSpacesAroundOperator public function Returns a boolean that indicates if operators must be surrounded by
spaces
Base::getSpacesInsideRoundBrackets public function Returns a boolean that indicates if content inside round brackets must be
surrounded by spaces
Base::__construct public function Class constructor

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal