You are here

interface GeneratorInterface in Style Guide 8

Same name and namespace in other branches
  1. 2.x src/GeneratorInterface.php \Drupal\styleguide\GeneratorInterface

Interface GeneratorInterface.

@package Drupal\styleguide

Hierarchy

Expanded class hierarchy of GeneratorInterface

All classes that implement GeneratorInterface

7 files declare their use of GeneratorInterface
CommentStyleguide.php in src/Plugin/Styleguide/CommentStyleguide.php
DefaultStyleguide.php in src/Plugin/Styleguide/DefaultStyleguide.php
ImageStyleguide.php in src/Plugin/Styleguide/ImageStyleguide.php
LayoutStyleguide.php in src/Plugin/Styleguide/LayoutStyleguide.php
SearchStyleguide.php in src/Plugin/Styleguide/SearchStyleguide.php

... See full list

File

src/GeneratorInterface.php, line 10

Namespace

Drupal\styleguide
View source
interface GeneratorInterface {

  /**
   * Return a simple array of words.
   *
   * @param int $size
   *   The size of the list to return.
   * @param int $words
   *   The number of words to generate.
   *
   * @return array
   *   An array of words.
   */
  public function wordList($size = 5, $words = 3);

  /**
   * Return a random word or words.
   *
   * @param int $size
   *   The number of words to return.
   * @param string $case
   *   A string indicating the case to return.
   *   This is the name of a PHP function.
   *   options are 'ucfirst', 'ucwords', 'strtoupper', and 'strtolower'.
   *   Defaults to return strtolower().
   */
  public function words($size = 1, $case = 'strtolower');

  /**
   * Return a random table header array.
   *
   * @param int $size
   *   The size of the list to return.
   *
   * @return array
   *   An array of header elements.
   */
  public function tableHeader($size = 5);

  /**
   * Return a random table row array.
   *
   * @param int $size
   *   The size of the list to return.
   *
   * @return array
   *   An array of row elements.
   */
  public function tableRows($size = 5);

  /**
   * Lorum ipsum text, used to generate words and phrases.
   *
   * @param int $size
   *   The size of the list to return.
   * @param int $words
   *   The number of words to return. Pass 0 for a whole paragraph.
   * @param string $case
   *   The case of the text. Options are 'mixed', 'upper' and 'lower'.
   * @param bool $returns
   *   Indicates whether line returns should not be stripped out of the result.
   * @param bool $punctuation
   *   Indicates whether punctuation should not be stripped out of the result.
   * @param bool $array
   *   Indicates that the return value should be an array instead of a string.
   *
   * @return string|array
   *   A string or array of content.
   */
  public function lorem($size = 5, $words = 0, $case = 'mixed', $returns = TRUE, $punctuation = TRUE, $array = FALSE);

  /**
   * Generate paragraph(s) of random text.
   *
   * @param int $size
   *   The number of paragraphs to return.
   * @param bool $render
   *   Allow to choose render the paragraph or return renderable array.
   *
   * @return array|string
   *   Renderable array or string of HTML paragraphs.
   */
  public function paragraphs($size = 5, $render = FALSE);

  /**
   * Generate a default image for display.
   *
   * @param string $image
   *   The name of the image. Will be prefixed with 'styleguide-image-'.
   * @param string $type
   *   The file type, (jpg, png, gif). Do not include a dot.
   *
   * @return string
   *   The Drupal path to the file.
   */
  public function image($image = 'vertical', $type = 'jpg');

  /**
   * Generate a random sentence.
   *
   * @param string $link
   *   The link to add to the sentence.
   */
  public function sentence($link = FALSE);

  /**
   * Simulate Drupal pagination,.
   *
   * @param int $size
   *   The number of page numbers to display.
   * @param int $total
   *   The total number of pages to simulate.
   *
   * @return array
   *   A Drupal pager HTML element.
   */
  public function pager($size = 8, $total = 20);

  /**
   * Generate a array of random links.
   *
   * @param string $url
   *   The internal path or external URL being linked to.
   * @param int $size
   *   The total number of links to generate .
   *
   * @return array
   *   A array of random links
   */
  public function links($url, $size = 4);

  /**
   * Generate a random menu item.
   *
   * @param string $url
   *   The internal path or external URL being linked to.
   *
   * @return array
   *   A random menu item, see menu_tree_page_data for a description of
   *   the data structure.
   */
  public function menuItem($url);

  /**
   * Generate a links array for theme_links.
   */
  public function ulLinks();

}

Members

Namesort descending Modifiers Type Description Overrides
GeneratorInterface::image public function Generate a default image for display. 1
GeneratorInterface::links public function Generate a array of random links. 1
GeneratorInterface::lorem public function Lorum ipsum text, used to generate words and phrases. 1
GeneratorInterface::menuItem public function Generate a random menu item. 1
GeneratorInterface::pager public function Simulate Drupal pagination,. 1
GeneratorInterface::paragraphs public function Generate paragraph(s) of random text. 1
GeneratorInterface::sentence public function Generate a random sentence. 1
GeneratorInterface::tableHeader public function Return a random table header array. 1
GeneratorInterface::tableRows public function Return a random table row array. 1
GeneratorInterface::ulLinks public function Generate a links array for theme_links. 1
GeneratorInterface::wordList public function Return a simple array of words. 1
GeneratorInterface::words public function Return a random word or words. 1