Файл: cobisja/BootHelp/src/BootHelp.php
Строк: 681
<?php
/**
* BootHelp - PHP Helpers for Bootstrap
*
* (The MIT License)
*
* Copyright (c) 2015 Jorge Cobis <jcobis@gmail.com / http://twitter.com/cobisja>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
namespace cobisjaBootHelp;
use cobisjaBootHelpAlertBox;
use cobisjaBootHelpButton;
use cobisjaBootHelpButtonGroup;
use cobisjaBootHelpButtonToolbar;
use cobisjaBootHelpCarousel;
use cobisjaBootHelpDropdown;
use cobisjaBootHelpHelpersBadge;
use cobisjaBootHelpHelpersContentTag;
use cobisjaBootHelpHelpersDivider;
use cobisjaBootHelpHelpersHorizontal;
use cobisjaBootHelpHelpersLinkTo;
use cobisjaBootHelpHelpersVertical;
use cobisjaBootHelpIcon;
use cobisjaBootHelpImage;
use cobisjaBootHelpLabel;
use cobisjaBootHelpListGroup;
use cobisjaBootHelpModal;
use cobisjaBootHelpNav;
use cobisjaBootHelpPanel;
use cobisjaBootHelpPanelRow;
use cobisjaBootHelpProgressBar;
use cobisjaBootHelpTable;
use cobisjaBootHelpThumbnail;
/**
* Class that exposes methods to interact with any BootHelp object.
*/
abstract class BootHelp
{
/**
* Gets a ContentTag instance.
*
* @param string $name Block tag type.
* @param mixed $content_or_options_with_block Options or closure.
* @param mixed $options Options or closure.
* @param callable $block closure that generates the content to be surrounding to.
*
* @return ContentTag a ContentTag instance.
*/
public static function contentTag(
$name,
$content_or_options_with_block = null,
$options = null,
callable $block = null
) {
return new ContentTag(
$name,
$content_or_options_with_block,
$options,
$block
);
}
/**
* Gets a Divider instance helper to be used with Dropdown objects.
*
* @return Divider a Divider instance.
*/
public static function divider()
{
return new Divider();
}
/**
* Gets Horizontal instance helper to be used with NavBar objects.
*
* @param mixed $content_or_options_with_block possible content of Horizontal object.
* @param mixed $options possible options of Horizontal object.
* @param closure $block Closure to build the Horizontal content.
*
* @return Vertical a Horizontal instance.
*/
public static function horizontal($content_or_options_with_block = null, $options = null, callable $block = null)
{
return new Horizontal($content_or_options_with_block, $options, $block);
}
/**
* Gets a LinkTo instance.
*
* @param mixed $name link target.
* @param array $options link options.
* @param callable $block closure that generates the content to be surrounding to.
*
* @return LinkTo a LinkTo instance.
*/
public static function linkTo($name = null, $options = null, callable $block = null)
{
return new LinkTo($name, $options, $block);
}
/**
* Gets Vertical instance helper to be used with NavBar objects.
*
* @param mixed $content_or_options_with_block possible content of Horizontal object.
* @param mixed $options possible options of Vertical object.
* @param closure $block Closure to build the Vertical content.
*
* @return Vertical a Vertical instance.
*/
public static function vertical($content_or_options_with_block = null, $options = null, callable $block = null)
{
return new Vertical($content_or_options_with_block, $options, $block);
}
/**
* Gets a Badge helper instance to be used with links, buttons, navs and anything you want.
*
* @param string $text Badge's text.
* @param array $options Badge's options
*
* @return Badge a Badge Helper instance.
*/
public static function badge($text, $options = [])
{
return new Badge($text, $options);
}
/**
* Gets an AlertBox instance.
*
* @param mixed $message_or_options_with_block string message or alert's options.
* @param mixed $options alert's options.
* @param mixed $block closure that generates alert's content.
*
* @return AlertBox an AlertBox instance.
*/
public static function alertBox($message_or_options_with_block = null, $options = null, $block = null)
{
return new AlertBox($message_or_options_with_block, $options, $block);
}
/**
* Gets a Button instance.
*
* @param mixed $content_or_options_with_block content of Button.
* @param mixed $options options to build a Button.
* @param closure $block closure to build the Button's content.
*
* @return Button a Button instance.
*/
public static function button($content_or_options_with_block = null, $options = null, $block = null)
{
return new Button($content_or_options_with_block, $options, $block);
}
/**
* Gets a ButtonGroup instance.
*
* @param mixed $options the display options for the ButtonGroup.
* @param Callable $block Block to generate inside ButtonGroup content.
*
* @return ButtonGroup a ButtonGroup instance.
*/
public static function buttonGroup($options, $block = null)
{
return new ButtonGroup($options, $block);
}
/**
* Gets a ButtonToolbar instance.
*
* @param mixed $options the display options for the ButtonToolbar.
* @param Callable $block Block to generate inside ButtonToolbar content.
*
* @return ButtonToolbar a ButtonToolbar instance.
*/
public static function buttonToolbar($options, $block = null)
{
return new ButtonToolbar($options, $block);
}
/**
* Gets a Carousel instance.
*
* @param mixed $content_or_options_with_block content of Carousel.
* @param closure $block closure to build the Carousel's content.
*
* @return Button a Carousel instance.
*/
public static function carousel($content_or_options_with_block, $block = null)
{
return new Carousel($content_or_options_with_block, $block);
}
/**
* Gets a Dropdown instance.
*
* @param string $caption Dropdown caption.
* @param array $options options to build the Dropdown.
* @param closure $block closure to build the Dropdown content.
*
* @return Dropdown a Dropdown instance.
*/
public static function dropdown($caption, $options = [], $block = null)
{
return new Dropdown($caption, $options, $block);
}
/**
* Gets an Icon instance.
*
* @param String $name the name of the icon object to build
* @param Array $options the options for the icon object.
*
* @return Icon an Icon instance.
*/
public static function icon($name = null, $options = [])
{
return new Icon($name, $options);
}
public static function image($options, $block = null)
{
return new Image($options, $block);
}
/**
* Gets a Label component instance.
*
* @param mixed $content_or_options_with_block the content to display into the label.
* @param mixed $options the display options for the label.
*
* @return Label a Label instance
*/
public static function label($content_or_options_with_block = null, $options = null)
{
return new Label($content_or_options_with_block, $options);
}
/**
* Gets a Modal instance.
*
* @param mixed $content_or_options_with_block the content to display in the Modal.
* @param mixed $options the display options for the Modal.
* @param mixed $block Block to generate a customized inside Modal content.
*
* @return Modal a Modal instance.
*/
public static function modal($content_or_options_with_block = null, $options = null, $block = null)
{
return new Modal($content_or_options_with_block, $options, $block);
}
/**
* Gets a Nav instance.
*
* @param array $options options the display options for the nav.
* @param mixed $block Block to generate a customized inside nav content.
*
* @return Nav a Nav instance.
*/
public static function nav($options = [], $block = null)
{
return new Nav($options, $block);
}
/**
* Gets a NavBar instance.
*
* @param array $options options the display options for the NavBar.
* @param mixed $block Block to generate a customized inside NavBar content.
*
* @return Navbar a NavBar instance
*/
public static function navbar($options = [], callable $block = null)
{
return new Navbar($options, $block);
}
/**
* Gets a Panel instance.
*
* @param mixed $content_or_options_with_block the content to display in the panel.
* @param mixed $options the display options for the panel.
* @param Callable $block Block to generate a customized inside panel content.
*
* @return Panel a Panel instance.
*/
public static function panel($content_or_options_with_block = null, $options = null, $block = null)
{
return new Panel($content_or_options_with_block, $options, $block);
}
/**
* Gets a PanelRow instance.
*
* @param mixed $options display options for the panel.
* @param Callable $block Block to generate inside panel row content.
*
* @return PanelRow a PanelRow instance.
*/
public static function panelRow($options, $block = null)
{
return new PanelRow($options, $block);
}
/**
* Gets a ProgressBar instance.
*
* @param array $options options to build the ProgressBar.
* @param array $container_options options to be passed to the ProgressBar's container.
*
* @return ProgressBar a ProgressBar instance.
*/
public static function progressBar($options = [], $container_options = [])
{
return new ProgressBar($options, $container_options);
}
/**
* Gets a Thumbnail instance.
*
* @param mixed $options options for Thumbnail component.
* @param Callable $block Block to generate inside thumbnail's content.
*
* @return Thumbnail a Thumbnail instance.
*/
public static function thumbnail($options, $block = null)
{
return new Thumbnail($options, $block);
}
/**
* Gets a ListGroup instance.
*
* @param mixed $content_or_options_with_block the display options for List group.
* @param Callable $block Block to generate customized List group content.
*
* @return ListGroup a ListGroup instance.
*/
public static function listGroup($content_or_options_with_block, $block = null)
{
return new ListGroup($content_or_options_with_block, $block);
}
/**
* Gets a Table instance.
*
* @param type $content_or_options_with_block
* @param type $block
*
* @return Table
*/
public static function table($content_or_options_with_block, $block = null)
{
return new Table($content_or_options_with_block, $block);
}
}