ICanBoogie/CLDR v1.6.0
  • Namespace
  • Class

Namespaces

  • ICanBoogie
    • CLDR

Classes

  • Calendar
  • CalendarCollection
  • ContextTransforms
  • Currency
  • CurrencyCollection
  • CurrencyFormatter
  • DateFormatter
  • DateTimeFormatter
  • FileProvider
  • ListFormatter
  • Locale
  • LocaleCollection
  • LocalizedCurrency
  • LocalizedDateTime
  • LocalizedListFormatter
  • LocalizedLocale
  • LocalizedNumberFormatter
  • LocalizedObject
  • LocalizedObjectWithFormatter
  • LocalizedTerritory
  • NumberFormatter
  • NumberPattern
  • NumberPatternParser
  • Numbers
  • ProviderCollection
  • RedisProvider
  • Repository
  • RunTimeProvider
  • Supplemental
  • Territory
  • TerritoryCollection
  • TimeFormatter
  • WebProvider

Interfaces

  • Exception
  • Formatter
  • LocalizeAwareInterface
  • Provider

Traits

  • CodePropertyTrait
  • CollectionTrait
  • LocalePropertyTrait
  • ProviderStorageBinding
  • RepositoryPropertyTrait

Exceptions

  • ResourceNotFound
  • TerritoryNotDefined
 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 56 57 58 59 
<?php

/*
 * This file is part of the ICanBoogie package.
 *
 * (c) Olivier Laviale <olivier.laviale@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace ICanBoogie\CLDR;

/**
 * Formats a variable-length lists of things.
 *
 * @property-read ListFormatter $target
 */
class LocalizedListFormatter extends LocalizedObject implements Formatter
{
    const TYPE_STANDARD = 'standard';
    const TYPE_UNIT = 'unit';
    const TYPE_UNIT_NARROW = 'unit-narrow';
    const TYPE_UNIT_SHORT = 'unit-short';

    /**
     * Formats a variable-length lists of things.
     *
     * @param array $list The list to format.
     * @param array|string $list_patterns_or_type A list patterns or a list patterns type (one
     * of `TYPE_*`).
     *
     * @return string
     */
    public function __invoke(array $list, $list_patterns_or_type = self::TYPE_STANDARD)
    {
        return $this->format($list, $list_patterns_or_type);
    }

    /**
     * Formats a variable-length lists of things.
     *
     * @param array $list The list to format.
     * @param array|string $list_patterns_or_type A list patterns or a list patterns type (one
     * of TYPE_*).
     *
     * @return string
     */
    public function format(array $list, $list_patterns_or_type = self::TYPE_STANDARD)
    {
        if (is_string($list_patterns_or_type))
        {
            $list_patterns_or_type = $this->locale['listPatterns']["listPattern-type-$list_patterns_or_type"];
        }

        return $this->target->format($list, $list_patterns_or_type);
    }
}
ICanBoogie/CLDR v1.6.0 API documentation generated by ApiGen