FireBug – API Documentation

UA1Labs\Fire\Bug

__construct()

The class constructor.

  • @return void
<?php
$fireBug = new \UA1Labs\Fire\Bug();

[static] get()

Returns the instance of \UA1Labs\Fire\Bug.

  • @return \UA1Labs\Fire\Bug
<?php
$fireBug = \UA1Labs\Fire\Bug::get();

enable()

Enables FireBug.

  • @return void
<?php
$fireBug = \UA1Labs\Fire\Bug::get();
$fireBug->enable();

isEnabled()

Determines if FireBug is enabled.

  • @return boolean
<?php
$fireBug = \UA1Labs\Fire\Bug::get();
$enabled = $fireBug->isEnabled();

destroy()

Destroys the current instance of FireBug.

  • @return void
<?php
$fireBug = \UA1Labs\Fire\Bug::get();
$fireBug->destroy();

addPanel($panel)

Adds a \UA1Labs\Fire\Bug\Panel object to the the array of panels. This method is used to register new panels with FireBug.

  • @param \UA1Labs\Fire\Bug\Panel $panel The panel you are adding to FireBug
  • @return void
<?php
$fireBug = \UA1Labs\Fire\Bug::get();
$panel = new \UA1Labs\Fire\Bug\DebugPanel();
$firebug->addPanel($panel);

getPanel($id)

Gets a stored panel object by its ID.

  • @param string $id The id of defined on the Fire\Bug\Panel instance object.
  • @return \UA1Labs\Fire\Bug\Panel
<?php
$fireBug = \UA1Labs\Fire\Bug::get();
$panel = $firebug->getPanel('debugPanel');

getPanels()

Gets all stored panels.

  • @return array<\UA1Labs\Fire\Bug\Panel>
<?php
$fireBug = \UA1Labs\Fire\Bug::get();
$panels = $firebug->getPanels();

timer($start = null)

Method used to measure the amount of time that passed in milliseconds. If you pass in a $start time, then you will be returned time length from the start time. If you don’t pass anything in, a start time will be returned.

  • @param float|null $start The start time
  • @return float
<?php
// getting a start timer
$fireBug = \UA1Labs\Fire\Bug::get();
$startTimer = $fireBug->timer();

// getting the amount of time that passed since the start timer
$timeLapsed = $fireBug->timer($startTimer);

getLoadTime()

If the timer was started, the load time will be returned.

  • @return float|false
<?php
$fireBug = \UA1Labs\Fire\Bug::get();
$fireBug->enable();
$loadTime = $fireBug->getLoadTime();

render()

Method used to render FireBug.

  • @return string The rendered panel
$fireBug = \UA1Labs\Fire\Bug::get();
echo $fireBug->render();

[abstract] UA1Labs\Fire\Bug\Panel

__construct($id, $name, $template)

The class constructor.

  • @param string $id The ID of this panel
  • @param string $name The name of this panel
  • @param string $template Path to a template for this panel
<?php
use \UA1Labs\Fire\Bug\Panel;
class MyPanel extends Panel
{
    const ID = 'myPanel';
    const NAME = 'My New Panel';

    public function __construct() {
        parent::__construct(self::ID, self::NAME, __DIR__ . '/my-template.phtml');
    }
}
$myPanel = new MyPanel();

getId()

Gets the ID for the given panel.

  • @return string The ID
<?php
$myPanel = new MyPanel();
$myPanelId = $myPanel->getId();

setName($name)

Sets the name for the given panel.

  • @param string $name The name of the panel
<?php
$myPanel = new MyPanel();
$myPanel->setName('My New Panel');

getName()

Gets the name for the given panel.

  • @return string The name
<?php
$myPanel = new MyPanel();
$myPanelName = $myPanel->getName();

renderLabel($content, $class = ”, $style = ”)

Returns a label to be used within a panel template.

  • @param string $content The content of the label
  • @param string $class A space separated list of classes you want to add
  • @param string $style Custom styles you want added
  • @return string HTML code for the label
<?php
// within the template.phtml template
echo $this->renderLabel('My Field Label');

renderSeparator($bold = true, $class = ”, $style = ”)

Returns a separator to be used within a template.

  • @param boolean $bold Do you want a bold separator
  • @param string $class CSV list of classes you want to add
  • @param string $style Custom styles you want added
  • @return string HTML code for the separator
<?php
// within the template.phtml template
echo $this->renderSeparator(false, 'firestudio-separator', 'margin-top: 20px; margin-left: 10px;');

renderCode($code, $dark = true)

Returns the code passed in wrapped within a <pre> tag.

  • @param string $content The code you want to render
  • @param boolean $dark Do you want the dark theme?
  • @return string The HTML to render
<?php
// within the template.phtml template
echo $this->renderCode($this->code, true);

renderJson($json, $dark = true)

Returns the JSON passed in wrapped within a <pre> tag.

  • @param string $content The code you want to render
  • @param boolean $dark Do you want the dark theme?
  • @return string The HTML to render
<?php
// within the template.phtml template
echo $this->renderJson($this->json);

renderTrace($debug_backtrace)

Returns a rendered debug_backtrace.

  • @param array $debug_backtrace
  • @return string HTML formatted backtrace
<?php
// within the template.phtml template
echo $this->renderTrace($this->trace);

render()

Renders the panel.

<?php
$myPanel = new MyPanel();
$myPanel->render();

Leave a comment

Leave a Reply