ICanBoogie/CLDR v1.7.0
  • Namespace
  • Class

Namespaces

  • ICanBoogie
    • CLDR
      • Plurals

Classes

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

Interfaces

  • Exception
  • Formatter
  • LocalizeAwareInterface
  • Provider

Traits

  • CodePropertyTrait
  • CollectionTrait
  • LocalePropertyTrait
  • LocalizeTrait
  • 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  60  61  62  63  64  65  66  67  68  69  70  71  72  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90  91  92  93  94  95  96  97  98  99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 
<?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;

use ICanBoogie\Accessor\AccessorTrait;

/**
 * Representation of a CLDR.
 *
 * <pre>
 * <?php
 *
 * namespace ICanBoogie\CLDR;
 *
 * $repository = new Repository($provider);
 *
 * var_dump($repository->locales['fr']);
 * var_dump($repository->territories['FR']);
 * </pre>
 *
 * @property-read Provider $provider
 * @property-read LocaleCollection $locales
 * @property-read Supplemental $supplemental
 * @property-read TerritoryCollection $territories
 * @property-read CurrencyCollection $currencies
 * @property-read NumberFormatter $number_formatter
 * @property-read ListFormatter $list_formatter
 * @property-read Plurals $plurals
 *
 * @see http://www.unicode.org/repos/cldr-aux/json/24/
 */
class Repository
{
    use AccessorTrait;

    /**
     * @var Provider
     */
    private $provider;

    /**
     * @return Provider
     */
    protected function get_provider()
    {
        return $this->provider;
    }

    /**
     * @return LocaleCollection
     */
    protected function lazy_get_locales()
    {
        return new LocaleCollection($this);
    }

    /**
     * @return Supplemental
     */
    protected function lazy_get_supplemental()
    {
        return new Supplemental($this);
    }

    /**
     * @return TerritoryCollection
     */
    protected function lazy_get_territories()
    {
        return new TerritoryCollection($this);
    }

    /**
     * @return CurrencyCollection
     */
    protected function lazy_get_currencies()
    {
        return new CurrencyCollection($this);
    }

    /**
     * @return NumberFormatter
     */
    protected function lazy_get_number_formatter()
    {
        return new NumberFormatter($this);
    }

    /**
     * @return ListFormatter
     */
    protected function lazy_get_list_formatter()
    {
        return new ListFormatter($this);
    }

    /**
     * @return Plurals
     */
    protected function lazy_get_plurals()
    {
        return new Plurals($this->supplemental['plurals']);
    }

    /**
     * Initializes the {@link $provider} property.
     *
     * @param Provider $provider
     */
    public function __construct(Provider $provider)
    {
        $this->provider = $provider;
    }

    /**
     * Fetches the data available at the specified path.
     *
     * Note: The method is forwarded to {@link Provider::provide}.
     *
     * @param string $path
     *
     * @return array
     */
    public function fetch($path)
    {
        return $this->provider->provide($path);
    }
}
ICanBoogie/CLDR v1.7.0 API documentation generated by ApiGen