Neevo Public API
  • Namespace
  • Class
  • Tree

Namespaces

  • Neevo
    • Nette
  • None
  • PHP

Classes

  • Neevo
  • NeevoBaseStmt
  • NeevoCacheFile
  • NeevoCacheMemcache
  • NeevoCacheMemory
  • NeevoCacheSession
  • NeevoConnection
  • NeevoDriverMySQL
  • NeevoDriverMySQLi
  • NeevoDriverPgSQL
  • NeevoDriverSQLite2
  • NeevoDriverSQLite3
  • NeevoLiteral
  • NeevoLoader
  • NeevoObserverMap
  • NeevoParser
  • NeevoResult
  • NeevoResultIterator
  • NeevoRow
  • NeevoStmt

Interfaces

  • INeevoCache
  • INeevoDriver
  • INeevoObservable
  • INeevoObserver

Exceptions

  • NeevoDriverException
  • NeevoException
  • NeevoImplementationException
 1 <?php
 2 /**
 3  * Neevo - Tiny database layer for PHP. (http://neevo.smasty.net)
 4  *
 5  * This source file is subject to the MIT license that is bundled
 6  * with this package in the file license.txt.
 7  *
 8  * Copyright (c) 2011 Martin Srank (http://smasty.net)
 9  *
10  */
11 
12 
13 /**
14  * Autoloader responsible for loading Neevo classes and interfaces.
15  * @author Martin Srank
16  * @package Neevo
17  */
18 class NeevoLoader {
19 
20 
21     /** @var array */
22     private $list = array(
23         'ineevocache' => '/NeevoCache.php',
24         'ineevodriver' => '/INeevoDriver.php',
25         'ineevoobservable' => '/INeevoObservable.php',
26         'ineevoobserver' => '/INeevoObserver.php',
27         'neevo' => '/Neevo.php',
28         'neevobasestmt' => '/NeevoBaseStmt.php',
29         'neevocachefile' => '/NeevoCache.php',
30         'neevocachememcache' => '/NeevoCache.php',
31         'neevocachememory' => '/NeevoCache.php',
32         'neevocachesession' => '/NeevoCache.php',
33         'neevoconnection' => '/NeevoConnection.php',
34         'neevodriverexception' => '/NeevoException.php',
35         'neevoexception' => '/NeevoException.php',
36         'neevoimplementationexception' => '/NeevoException.php',
37         'neevoliteral' => '/Neevo.php',
38         'neevoobservermap' => '/NeevoObserverMap.php',
39         'neevoparser' => '/NeevoParser.php',
40         'neevoresult' => '/NeevoResult.php',
41         'neevoresultiterator' => '/NeevoResultIterator.php',
42         'neevorow' => '/NeevoRow.php',
43         'neevostmt' => '/NeevoStmt.php',
44     );
45 
46     /** @var NeevoLoader */
47     private static $instance;
48 
49 
50     private function __construct(){}
51 
52 
53     /**
54     * Get the singleton instance.
55     * @return NeevoLoader
56     */
57     public static function getInstance(){
58         if(self::$instance === null)
59             self::$instance = new self;
60         return self::$instance;
61     }
62 
63 
64     /**
65      * Register the autoloader.
66      * @return void
67      */
68     public function register(){
69         spl_autoload_register(array($this, 'tryLoad'));
70     }
71 
72 
73     /**
74      * Unregister the autoloader.
75      * @return void
76      */
77     public function unregister(){
78         spl_autoload_unregister(array($this, 'tryLoad'));
79     }
80 
81 
82     /**
83      * Try load Neevo class/interface.
84      * @param string $type
85      * @return bool
86      */
87     public function tryLoad($type){
88         $type = trim(strtolower($type), '\\');
89 
90         if(isset($this->list[$type]))
91             return include_once dirname(__FILE__) . $this->list[$type];
92         return false;
93     }
94 
95 
96 }
97 
Neevo Public API API documentation generated by ApiGen 2.8.0