PageRenderTime 3ms CodeModel.GetById 3ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/libs/Nette/Loaders/NetteLoader.php

https://github.com/bazo/diplomovka
PHP | 229 lines | 189 code | 13 blank | 27 comment | 2 complexity | a957f45b4770e4eca7a02de3869929a9 MD5 | raw file
  1<?php
  2
  3/**
  4 * Nette Framework
  5 *
  6 * @copyright  Copyright (c) 2004, 2010 David Grudl
  7 * @license    http://nettephp.com/license  Nette license
  8 * @link       http://nettephp.com
  9 * @category   Nette
 10 * @package    Nette\Loaders
 11 */
 12
 13
 14
 15/**
 16 * Nette auto loader is responsible for loading Nette classes and interfaces.
 17 *
 18 * @copyright  Copyright (c) 2004, 2010 David Grudl
 19 * @package    Nette\Loaders
 20 */
 21class NetteLoader extends AutoLoader
 22{
 23	/** @var NetteLoader */
 24	public static $instance;
 25
 26	/** @var string  base file path */
 27	public $base;
 28
 29	/** @var array */
 30	public $list = array(
 31		'abortexception' => '/Application/Exceptions/AbortException.php',
 32		'ambiguousserviceexception' => '/ServiceLocator.php',
 33		'annotation' => '/Reflection/Annotation.php',
 34		'annotationsparser' => '/Reflection/AnnotationsParser.php',
 35		'appform' => '/Application/AppForm.php',
 36		'application' => '/Application/Application.php',
 37		'applicationexception' => '/Application/Exceptions/ApplicationException.php',
 38		'argumentoutofrangeexception' => '/exceptions.php',
 39		'arraylist' => '/Collections/ArrayList.php',
 40		'arraytools' => '/ArrayTools.php',
 41		'authenticationexception' => '/Security/AuthenticationException.php',
 42		'autoloader' => '/Loaders/AutoLoader.php',
 43		'badrequestexception' => '/Application/Exceptions/BadRequestException.php',
 44		'badsignalexception' => '/Application/Exceptions/BadSignalException.php',
 45		'basetemplate' => '/Templates/BaseTemplate.php',
 46		'button' => '/Forms/Controls/Button.php',
 47		'cache' => '/Caching/Cache.php',
 48		'cachinghelper' => '/Templates/Filters/CachingHelper.php',
 49		'callback' => '/Callback.php',
 50		'checkbox' => '/Forms/Controls/Checkbox.php',
 51		'classreflection' => '/Reflection/ClassReflection.php',
 52		'clirouter' => '/Application/Routers/CliRouter.php',
 53		'collection' => '/Collections/Collection.php',
 54		'component' => '/Component.php',
 55		'componentcontainer' => '/ComponentContainer.php',
 56		'config' => '/Config/Config.php',
 57		'configadapterini' => '/Config/ConfigAdapterIni.php',
 58		'configurator' => '/Configurator.php',
 59		'control' => '/Application/Control.php',
 60		'conventionalrenderer' => '/Forms/Renderers/ConventionalRenderer.php',
 61		'datetime53' => '/compatibility/DateTime53.php',
 62		'debug' => '/Debug.php',
 63		'deprecatedexception' => '/exceptions.php',
 64		'directorynotfoundexception' => '/exceptions.php',
 65		'downloadresponse' => '/Application/Responses/DownloadResponse.php',
 66		'dummystorage' => '/Caching/DummyStorage.php',
 67		'environment' => '/Environment.php',
 68		'extensionreflection' => '/Reflection/ExtensionReflection.php',
 69		'fatalerrorexception' => '/exceptions.php',
 70		'filenotfoundexception' => '/exceptions.php',
 71		'filestorage' => '/Caching/FileStorage.php',
 72		'fileupload' => '/Forms/Controls/FileUpload.php',
 73		'forbiddenrequestexception' => '/Application/Exceptions/ForbiddenRequestException.php',
 74		'form' => '/Forms/Form.php',
 75		'formcontainer' => '/Forms/FormContainer.php',
 76		'formcontrol' => '/Forms/Controls/FormControl.php',
 77		'formgroup' => '/Forms/FormGroup.php',
 78		'forwardingresponse' => '/Application/Responses/ForwardingResponse.php',
 79		'framework' => '/Framework.php',
 80		'freezableobject' => '/FreezableObject.php',
 81		'ftp' => '/Web/Ftp.php',
 82		'ftpexception' => '/Web/Ftp.php',
 83		'functionreflection' => '/Reflection/FunctionReflection.php',
 84		'hashtable' => '/Collections/Hashtable.php',
 85		'hiddenfield' => '/Forms/Controls/HiddenField.php',
 86		'html' => '/Web/Html.php',
 87		'httpcontext' => '/Web/HttpContext.php',
 88		'httprequest' => '/Web/HttpRequest.php',
 89		'httpresponse' => '/Web/HttpResponse.php',
 90		'httpuploadedfile' => '/Web/HttpUploadedFile.php',
 91		'iannotation' => '/Reflection/IAnnotation.php',
 92		'iauthenticator' => '/Security/IAuthenticator.php',
 93		'iauthorizator' => '/Security/IAuthorizator.php',
 94		'icachestorage' => '/Caching/ICacheStorage.php',
 95		'icollection' => '/Collections/ICollection.php',
 96		'icomponent' => '/IComponent.php',
 97		'icomponentcontainer' => '/IComponentContainer.php',
 98		'iconfigadapter' => '/Config/IConfigAdapter.php',
 99		'idebuggable' => '/IDebuggable.php',
100		'identity' => '/Security/Identity.php',
101		'ifiletemplate' => '/Templates/IFileTemplate.php',
102		'iformcontrol' => '/Forms/IFormControl.php',
103		'iformrenderer' => '/Forms/IFormRenderer.php',
104		'ihttprequest' => '/Web/IHttpRequest.php',
105		'ihttpresponse' => '/Web/IHttpResponse.php',
106		'iidentity' => '/Security/IIdentity.php',
107		'ilist' => '/Collections/IList.php',
108		'image' => '/Image.php',
109		'imagebutton' => '/Forms/Controls/ImageButton.php',
110		'imagemagick' => '/ImageMagick.php',
111		'imailer' => '/Mail/IMailer.php',
112		'imap' => '/Collections/IMap.php',
113		'inamingcontainer' => '/Forms/INamingContainer.php',
114		'instancefilteriterator' => '/InstanceFilterIterator.php',
115		'instantclientscript' => '/Forms/Renderers/InstantClientScript.php',
116		'invalidlinkexception' => '/Application/Exceptions/InvalidLinkException.php',
117		'invalidpresenterexception' => '/Application/Exceptions/InvalidPresenterException.php',
118		'invalidstateexception' => '/exceptions.php',
119		'ioexception' => '/exceptions.php',
120		'ipartiallyrenderable' => '/Application/IRenderable.php',
121		'ipermissionassertion' => '/Security/IPermissionAssertion.php',
122		'ipresenter' => '/Application/IPresenter.php',
123		'ipresenterloader' => '/Application/IPresenterLoader.php',
124		'ipresenterresponse' => '/Application/IPresenterResponse.php',
125		'irenderable' => '/Application/IRenderable.php',
126		'iresource' => '/Security/IResource.php',
127		'irole' => '/Security/IRole.php',
128		'irouter' => '/Application/IRouter.php',
129		'iservicelocator' => '/IServiceLocator.php',
130		'iset' => '/Collections/ISet.php',
131		'isignalreceiver' => '/Application/ISignalReceiver.php',
132		'istatepersistent' => '/Application/IStatePersistent.php',
133		'isubmittercontrol' => '/Forms/ISubmitterControl.php',
134		'itemplate' => '/Templates/ITemplate.php',
135		'itranslator' => '/ITranslator.php',
136		'iuser' => '/Web/IUser.php',
137		'jsonresponse' => '/Application/Responses/JsonResponse.php',
138		'keynotfoundexception' => '/Collections/Hashtable.php',
139		'lattefilter' => '/Templates/Filters/LatteFilter.php',
140		'lattemacros' => '/Templates/Filters/LatteMacros.php',
141		'limitedscope' => '/Loaders/LimitedScope.php',
142		'link' => '/Application/Link.php',
143		'mail' => '/Mail/Mail.php',
144		'mailmimepart' => '/Mail/MailMimePart.php',
145		'memberaccessexception' => '/exceptions.php',
146		'memcachedstorage' => '/Caching/MemcachedStorage.php',
147		'methodparameterreflection' => '/Reflection/MethodParameterReflection.php',
148		'methodreflection' => '/Reflection/MethodReflection.php',
149		'multirouter' => '/Application/Routers/MultiRouter.php',
150		'multiselectbox' => '/Forms/Controls/MultiSelectBox.php',
151		'netteloader' => '/Loaders/NetteLoader.php',
152		'notimplementedexception' => '/exceptions.php',
153		'notsupportedexception' => '/exceptions.php',
154		'object' => '/Object.php',
155		'objectmixin' => '/ObjectMixin.php',
156		'paginator' => '/Paginator.php',
157		'permission' => '/Security/Permission.php',
158		'presenter' => '/Application/Presenter.php',
159		'presentercomponent' => '/Application/PresenterComponent.php',
160		'presentercomponentreflection' => '/Application/PresenterComponentReflection.php',
161		'presenterloader' => '/Application/PresenterLoader.php',
162		'presenterrequest' => '/Application/PresenterRequest.php',
163		'propertyreflection' => '/Reflection/PropertyReflection.php',
164		'radiolist' => '/Forms/Controls/RadioList.php',
165		'recursivecomponentiterator' => '/ComponentContainer.php',
166		'recursivehtmliterator' => '/Web/Html.php',
167		'redirectingresponse' => '/Application/Responses/RedirectingResponse.php',
168		'renderresponse' => '/Application/Responses/RenderResponse.php',
169		'robotloader' => '/Loaders/RobotLoader.php',
170		'route' => '/Application/Routers/Route.php',
171		'rule' => '/Forms/Rule.php',
172		'rules' => '/Forms/Rules.php',
173		'safestream' => '/IO/SafeStream.php',
174		'selectbox' => '/Forms/Controls/SelectBox.php',
175		'sendmailmailer' => '/Mail/SendmailMailer.php',
176		'servicelocator' => '/ServiceLocator.php',
177		'session' => '/Web/Session.php',
178		'sessionnamespace' => '/Web/SessionNamespace.php',
179		'set' => '/Collections/Set.php',
180		'simpleauthenticator' => '/Security/SimpleAuthenticator.php',
181		'simplerouter' => '/Application/Routers/SimpleRouter.php',
182		'smartcachingiterator' => '/SmartCachingIterator.php',
183		'snippethelper' => '/compatibility/SnippetHelper.php',
184		'string' => '/String.php',
185		'submitbutton' => '/Forms/Controls/SubmitButton.php',
186		'template' => '/Templates/Template.php',
187		'templatecachestorage' => '/Templates/TemplateCacheStorage.php',
188		'templatefilters' => '/Templates/Filters/TemplateFilters.php',
189		'templatehelpers' => '/Templates/Filters/TemplateHelpers.php',
190		'textarea' => '/Forms/Controls/TextArea.php',
191		'textbase' => '/Forms/Controls/TextBase.php',
192		'textinput' => '/Forms/Controls/TextInput.php',
193		'tools' => '/Tools.php',
194		'uri' => '/Web/Uri.php',
195		'uriscript' => '/Web/UriScript.php',
196		'user' => '/Web/User.php',
197	);
198
199
200
201	/**
202	 * Returns singleton instance with lazy instantiation.
203	 * @return NetteLoader
204	 */
205	public static function getInstance()
206	{
207		if (self::$instance === NULL) {
208			self::$instance = new self;
209		}
210		return self::$instance;
211	}
212
213
214
215	/**
216	 * Handles autoloading of classes or interfaces.
217	 * @param  string
218	 * @return void
219	 */
220	public function tryLoad($type)
221	{
222		$type = strtolower($type);
223		if (isset($this->list[$type])) {
224			LimitedScope::load($this->base . $this->list[$type]);
225			self::$count++;
226		}
227	}
228
229}