ICanBoogie/Common v1.2.2.1
  • Namespace
  • Class

Namespaces

  • ICanBoogie

Classes

  • FormattedString

Interfaces

  • ToArray
  • ToArrayRecursive

Traits

  • ToArrayRecursiveTrait

Exceptions

  • OffsetError
  • OffsetNotDefined
  • OffsetNotReadable
  • OffsetNotWritable
  • PropertyError
  • PropertyIsReserved
  • PropertyNotDefined
  • PropertyNotReadable
  • PropertyNotWritable

Functions

  • array_flatten
  • array_insert
  • array_merge_recursive
  • capitalize
  • downcase
  • dump
  • escape
  • escape_all
  • exact_array_merge_recursive
  • format
  • generate_v4_uuid
  • normalize
  • normalize_url_path
  • remove_accents
  • shorten
  • sort_by_weight
  • stable_sort
  • unaccent_compare
  • unaccent_compare_ci
  • upcase
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 
<?php

namespace ICanBoogie;

/**
 * A formatted string.
 *
 * The string is formatted by replacing placeholders with the values provided.
 */
class FormattedString
{
    /**
     * String format.
     *
     * @var string
     */
    protected $format;

    /**
     * An array of replacements for the placeholders.
     *
     * @var array
     */
    protected $args;

    /**
     * Initializes the {@link $format} and {@link $args} properties.
     *
     * @param string $format String format.
     * @param array $args Format arguments.
     *
     * @see format()
     */
    public function __construct($format, $args=null)
    {
        if (!is_array($args))
        {
            $args = func_get_args();
            array_shift($args);
        }

        $this->format = $format;
        $this->args = (array) $args;
    }

    /**
     * Returns the string formatted with the {@link format()} function.
     *
     * @return string
     */
    public function __toString()
    {
        return format($this->format, $this->args);
    }
}
ICanBoogie/Common v1.2.2.1 API documentation generated by ApiGen