Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • Calendar
  • CalendarCollection
  • DateFormatter
  • DateTimeFormatter
  • FileCache
  • Locale
  • LocaleCollection
  • LocalizedDateTime
  • LocalizedObject
  • Provider
  • Repository
  • Retriever
  • RunTimeCache
  • Supplemental
  • TimeFormatter

Interfaces

  • Cache

Exceptions

  • ResourceNotFound
  1 <?php
  2 
  3 /*
  4  * This file is part of the ICanBoogie package.
  5  *
  6  * (c) Olivier Laviale <olivier.laviale@gmail.com>
  7  *
  8  * For the full copyright and license information, please view the LICENSE
  9  * file that was distributed with this source code.
 10  */
 11 
 12 namespace ICanBoogie\CLDR;
 13 
 14 /**
 15  * Representation of the "supplemental" section.
 16  *
 17  * <pre>
 18  * <?php
 19  *
 20  * use ICanBoogie\CLDR\Supplemental;
 21  *
 22  * $supplemental = new Supplemental($repository);
 23  *
 24  * echo $supplemental['calendarPreferenceData']['001']; // gregorian
 25  * </pre>
 26  */
 27 class Supplemental implements \ArrayAccess
 28 {
 29     static private $available_sections = array
 30     (
 31         'calendarData'           => 'calendarData',
 32         'calendarPreferenceData' => 'calendarPreferenceData',
 33         'characterFallbacks'     => 'characters/character-fallback',
 34         'codeMappings'           => 'codeMappings',
 35         'currencyData'           => 'currencyData',
 36         'dayPeriods'             => 'dayPeriodRuleSet',
 37         'gender'                 => 'gender',
 38         'languageData'           => 'languageData',
 39         'languageMatching'       => 'languageMatching',
 40         'likelySubtags'          => 'likelySubtags',
 41         'measurementData'        => 'measurementData',
 42         'metaZones'              => 'metaZones',
 43         'numberingSystems'       => 'numberingSystems',
 44         'ordinals'               => 'plurals-type-ordinal',
 45         'parentLocales'          => 'parentLocales',
 46         'plurals'                => 'plurals-type-cardinal',
 47         'postalCodeData'         => 'postalCodeData',
 48         'primaryZones'           => 'primaryZones',
 49         'references'             => 'references',
 50         'telephoneCodeData'      => 'telephoneCodeData',
 51         'territoryContainment'   => 'territoryContainment',
 52         'territoryInfo'          => 'territoryInfo',
 53         'timeData'               => 'timeData',
 54         'weekData'               => 'weekData',
 55         'windowsZones'           => 'windowsZones'
 56     );
 57 
 58     /**
 59      * Representation of a CLRD repository.
 60      *
 61      * @var Repository
 62      */
 63     protected $repository;
 64 
 65     /**
 66      * Loaded sections.
 67      *
 68      * @var array
 69      */
 70     protected $sections = array();
 71 
 72     /**
 73      * Initializes the {@link $repository} property.
 74      *
 75      * @param Repository $repository Representation of a CLDR.
 76      */
 77     public function __construct(Repository $repository)
 78     {
 79         $this->repository = $repository;
 80     }
 81 
 82     public function offsetExists($offset)
 83     {
 84         return isset(self::$available_sections[$offset]);
 85     }
 86 
 87     public function offsetGet($offset)
 88     {
 89         if (empty($this->sections[$offset]))
 90         {
 91             if (empty(self::$available_sections[$offset]))
 92             {
 93                 throw new OffsetNotDefined(array($offset, $this));
 94             }
 95 
 96             $data = $this->repository->provider->fetch("supplemental/{$offset}");
 97             $path = 'supplemental/' . self::$available_sections[$offset];
 98             $path_parts = explode('/', $path);
 99 
100             foreach ($path_parts as $part)
101             {
102                 $data = $data[$part];
103             }
104 
105             $this->sections[$offset] = $data;
106         }
107 
108         return $this->sections[$offset];
109     }
110 
111     public function offsetSet($offset, $value)
112     {
113         throw new OffsetNotWritable(array($offset, $this));
114     }
115 
116     public function offsetUnset($offset)
117     {
118         throw new OffsetNotWritable(array($offset, $this));
119     }
120 }
Autodoc API documentation generated by ApiGen 2.8.0