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

  • PropertyEvent

Functions

  • get_public_object_vars
  1 <?php
  2 
  3 namespace ICanBoogie\Object;
  4 
  5 /**
  6  * Event class for the `ICanBoogie\Object::property` event.
  7  *
  8  * The `ICanBoogie\Object::property` event is fired when no getter was found in a class or
  9  * prototype to obtain the value of a property.
 10  *
 11  * Hooks can be attached to that event to provide the value of the property. Should they be able
 12  * to provide the value, they must create the `value` property within the event object. Thus, even
 13  * `null` is considered a valid result.
 14  */
 15 class PropertyEvent extends \ICanBoogie\Event
 16 {
 17     /**
 18      * The name of the property to retrieve.
 19      *
 20      * @var string
 21      */
 22     public $property;
 23 
 24     /**
 25      * The event is created with the type `property`.
 26      *
 27      * @param \ICanBoogie\Object $target
 28      * @param array $payload
 29      */
 30     public function __construct($target, array $payload)
 31     {
 32         parent::__construct($target, 'property', $payload);
 33     }
 34 }
 35 
 36 namespace ICanBoogie;
 37 
 38 /*
 39  * Patch Prototype helpers
 40  */
 41 Prototype\Helpers::patch('last_chance_get', function ($target, $property, &$success)
 42 {
 43     global $core;
 44 
 45     if (empty($core))
 46     {
 47         return;
 48     }
 49 
 50     $event = new Object\PropertyEvent($target, [ 'property' => $property ]);
 51 
 52     #
 53     # The operation is considered a success if the `value` property exists in the event
 54     # object. Thus, even a `null` value is considered a success.
 55     #
 56 
 57     if (!property_exists($event, 'value'))
 58     {
 59         return;
 60     }
 61 
 62     $success = true;
 63 
 64     return $event->value;
 65 });
 66 
 67 /*
 68  * Patch Active Record helpers
 69  */
 70 ActiveRecord\Helpers::patch('get_model', function($id) {
 71 
 72     return Core::get()->models[$id];
 73 
 74 });
 75 
 76 namespace ICanBoogie\HTTP;
 77 
 78 /*
 79  * Patches the `get_dispatcher` helper to initialize the dispatcher with the operation and route
 80  * dispatchers.
 81  */
 82 Helpers::patch('get_dispatcher', function() {
 83 
 84     static $dispatcher;
 85 
 86     if (!$dispatcher)
 87     {
 88         $dispatcher = new Dispatcher([
 89 
 90             'operation' => 'ICanBoogie\Operation\Dispatcher',
 91             'route' => 'ICanBoogie\Routing\Dispatcher'
 92 
 93         ]);
 94 
 95         new Dispatcher\AlterEvent($dispatcher);
 96     }
 97 
 98     return $dispatcher;
 99 
100 });
101 
102 namespace ICanBoogie\HTTP\Dispatcher;
103 
104 use ICanBoogie\HTTP\Dispatcher;
105 
106 /**
107  * Event class for the `ICanBoogie\HTTP\Dispatcher::alter` event.
108  *
109  * Third parties may use this event to register additionnal dispatchers.
110  */
111 class AlterEvent extends \ICanBoogie\Event
112 {
113     /**
114      * The event is constructed with the type `alter`.
115      *
116      * @param Dispatcher $target
117      */
118     public function __construct(Dispatcher $target)
119     {
120         parent::__construct($target, 'alter');
121     }
122 }
Autodoc API documentation generated by ApiGen 2.8.0