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 class Provider
15 {
16     protected $cache;
17     protected $retriever;
18 
19     public function __construct($cache, $retriever)
20     {
21         $this->cache = $cache;
22         $this->retriever = $retriever;
23     }
24 
25     /**
26      * Fetches the data available at the specified path.
27      *
28      * @param string $path
29      *
30      * @return array
31      */
32     public function fetch($path)
33     {
34         $json = $this->cache->retrieve($path);
35 
36         if (!$json)
37         {
38             $retriever = $this->retriever;
39             $json = $retriever($path);
40 
41             if ($json)
42             {
43                 $this->cache->store($path, $json);
44             }
45         }
46 
47         return json_decode($json, true);
48     }
49 
50     public function __invoke($path)
51     {
52         return $this->fetch($path);
53     }
54 }
Autodoc API documentation generated by ApiGen 2.8.0