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

  • PropertyRenderers
  • Rendering
  1 <?php
  2 
  3 namespace Icybee\Rendering;
  4 
  5 use ICanBoogie\OffsetNotWritable;
  6 
  7 use BlueTihi\render;
  8 
  9 use ICanBoogie\Exception;
 10 
 11 class PropertyRenderers implements \IteratorIterator, \ArrayAccess
 12 {
 13     /**
 14      * Singleton instance of the class.
 15      *
 16      * @var PropertyRenderers
 17      */
 18     protected static $instance;
 19 
 20     /**
 21      * Returns the singleton instance of the class.
 22      *
 23      * @return Events
 24      */
 25     static public function get()
 26     {
 27         if (!self::$instance)
 28         {
 29             self::$instance = new static();
 30         }
 31 
 32         return self::$instance;
 33     }
 34 
 35     /**
 36      * Synthesizes events config.
 37      *
 38      * Events are retrieved from the "hooks" config, under the "events" namespace.
 39      *
 40      * @param array $fragments
 41      * @throws \InvalidArgumentException when a callback is not properly defined.
 42      *
 43      * @return array[string]array
 44      */
 45     static public function synthesize_config(array $fragments)
 46     {
 47         $collection = array();
 48 
 49         foreach ($fragments as $pathname => $fragment)
 50         {
 51             if (empty($fragment['properties']))
 52             {
 53                 continue;
 54             }
 55 
 56             foreach ($fragment['properties'] as $key => $callback)
 57             {
 58                 if (!strpos($key, '::'))
 59                 {
 60                     throw new \InvalidArgumentException(format
 61                     (
 62                         'Property definition must be <code>{class}/{property}</code> given: :key in %path', array
 63                         (
 64                             'key' => $key,
 65                             'path' => $pathname
 66                         )
 67                     ));
 68                 }
 69 
 70                 list($class, $property) = explode('::', $key);
 71 
 72                 $collection[$property][$class][] = $callback;
 73             }
 74         }
 75 
 76         return $collection;
 77     }
 78 
 79     protected $collection = array();
 80 
 81     /**
 82      * Obtains the collection for the config synthesizer.
 83      */
 84     protected function __construct()
 85     {
 86         global $core;
 87 
 88         $this->collection = $core->configs['rendering.properties'];
 89 
 90         // TODO-20120713: fire an event to alter the collection
 91     }
 92 
 93     /**
 94      * Returns an iterator for callbacks.
 95      */
 96     public function getIterator()
 97     {
 98         return new \ArrayIterator($this->collection);
 99     }
100 
101     /**
102      * Checks if a callback exists for a class+property.
103      */
104     public function offsetExists($offset)
105     {
106         return isset($this->collection[$offset]);
107     }
108 
109     /**
110      * Returns the callbacks for a class+property.
111      */
112     public function offsetGet($offset)
113     {
114         list($class, $property) = explode('::', $offset);
115     }
116 
117     /**
118      * @throws OffsetNotWritable in attempt to set an offset.
119      */
120     public function offsetSet($offset, $value)
121     {
122         throw new OffsetNotWritable(array($offset, $this));
123     }
124 
125     /**
126      * @throws OffsetNotWritable in attempt to unset an offset.
127      */
128     public function offsetUnset($offset)
129     {
130         throw new OffsetNotWritable(array($offset, $this));
131     }
132 }
133 
134 class Rendering
135 {
136     static public function render($source, array $options=array())
137     {
138 
139     }
140 }
141 
142 return array
143 (
144     'properties' => array
145     (
146         'Icybee\Modules\Nodes\Node::title' => 'callback'
147     ),
148 
149     'records' => array
150     (
151         'Icybee\Modules\Nodes\Node' => 'callback'
152     ),
153 
154     'template' => array
155     (
156         'php' => array
157         (
158             'class' => 'Engine'
159         )
160     )
161 );
162 
Autodoc API documentation generated by ApiGen 2.8.0