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

  • Helpers
  • Hooks

Exceptions

  • MethodNotDefined

Functions

  • last_chance_get
  • last_chance_set
 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\Prototype;
13 
14 class Hooks
15 {
16     /**
17      * Synthesizes the "prototypes" config from the "hooks" config.
18      *
19      * @param array $fragments
20      *
21      * @return array[string]callable
22      *
23      * @throws \InvalidArgumentException if a method definition is missing the '::' separator.
24      */
25     static public function synthesize_config(array $fragments)
26     {
27         $methods = [];
28 
29         foreach ($fragments as $pathname => $fragment)
30         {
31             if (empty($fragment['prototypes']))
32             {
33                 continue;
34             }
35 
36             foreach ($fragment['prototypes'] as $method => $callback)
37             {
38                 if (strpos($method, '::') === false)
39                 {
40                     throw new \InvalidArgumentException(sprintf
41                     (
42                         'Invalid method name "%s", must be <code>class_name::method_name</code> in "%s"', $method, $pathname
43                     ));
44                 }
45 
46                 list($class, $method) = explode('::', $method);
47 
48                 $methods[$class][$method] = $callback;
49             }
50         }
51 
52         return $methods;
53     }
54 }
Autodoc API documentation generated by ApiGen 2.8.0