├── .gitignore ├── LICENSE ├── README ├── README.1.3.x ├── build.properties ├── build.xml ├── composer.json ├── composer.lock ├── docs └── examples │ ├── ComponentAnnotation │ └── example.php │ ├── ConfigurationAnnotation │ └── example.php │ ├── ErrorHandler │ ├── annotated │ │ ├── example.php │ │ └── log4php.properties │ ├── beans.xml │ └── example.php │ ├── InjectAnnotation │ └── example.php │ ├── PAGI │ ├── beans.xml │ ├── example.php │ ├── file.properties │ ├── log4php.properties │ └── run.sh │ ├── PAMI │ ├── beans.xml │ └── example.php │ ├── PhpProperties │ ├── beans.xml │ ├── example.php │ └── file.properties │ ├── PropertiesAnnotation │ ├── beans.xml │ └── example.php │ ├── RequiredAnnotation │ ├── beans.xml │ └── example.php │ ├── ResourceAnnotation │ ├── beans.xml │ └── example.php │ ├── ShutdownHandler │ ├── annotated │ │ ├── example.php │ │ └── log4php.properties │ ├── beans.xml │ └── example.php │ ├── SignalHandler │ ├── annotated │ │ ├── example.php │ │ └── log4php.properties │ ├── beans.xml │ └── example.php │ ├── SyslogHelper │ ├── beans.xml │ └── example.php │ ├── TCPClientHelper │ ├── beans.xml │ ├── example.php │ └── file.properties │ ├── TCPServerHelper │ ├── beans.xml │ ├── example.php │ └── file.properties │ ├── ValueAnnotation │ └── example.php │ ├── alias-annotations │ └── example.php │ ├── alias-xml │ ├── beans.xml │ └── example.php │ ├── alias-yaml │ ├── beans.yaml │ └── example.php │ ├── aop-annotation │ ├── beans.xml │ └── example.php │ ├── aop-global │ ├── beans.xml │ └── example.php │ ├── aop-regex │ ├── beans.xml │ └── example.php │ ├── aop │ ├── beans.xml │ └── example.php │ ├── arrays │ ├── beans.xml │ └── example.php │ ├── basic-with-phar │ ├── beans.xml │ └── example.php │ ├── basic │ ├── beans.xml │ └── example.php │ ├── bookstore │ ├── README │ ├── cli-config.php │ ├── private │ │ ├── config │ │ │ ├── application.properties │ │ │ ├── doctrine.properties │ │ │ ├── log4php.properties │ │ │ └── php.properties │ │ ├── context │ │ │ ├── beans.xml │ │ │ ├── i18n.xml │ │ │ ├── mvc.xml │ │ │ └── persistence.xml │ │ ├── i18n │ │ │ ├── books_default.properties │ │ │ └── books_es_ES.properties │ │ └── src │ │ │ └── BookStore │ │ │ ├── Aspect │ │ │ ├── Profiler.php │ │ │ └── Transactional.php │ │ │ ├── Controllers │ │ │ ├── Book.php │ │ │ ├── Exception.php │ │ │ ├── Main.php │ │ │ └── Settings.php │ │ │ ├── Domain │ │ │ ├── Entity │ │ │ │ └── Book.php │ │ │ ├── Repository │ │ │ │ ├── BookRepository.php │ │ │ │ └── Configuration.php │ │ │ └── Service │ │ │ │ ├── AbstractService.php │ │ │ │ └── Book.php │ │ │ └── ErrorHandler │ │ │ └── ErrorHandler.php │ └── public │ │ ├── bootstrap.php │ │ ├── favicon.ico │ │ ├── index.php │ │ └── views │ │ ├── createBook.phtml │ │ ├── created.phtml │ │ ├── exception.phtml │ │ ├── footer.phtml │ │ ├── header.phtml │ │ ├── home.phtml │ │ ├── layout.phtml │ │ ├── list.phtml │ │ └── main.phtml │ ├── doctrine │ ├── README │ ├── beans.xml │ ├── entities │ │ └── Person.php │ ├── example.php │ └── schema.sql │ ├── events │ ├── beans.xml │ ├── beans.yaml │ └── example.php │ ├── i18n │ ├── another_bundle_es.properties │ ├── beans.xml │ ├── default_es.properties │ └── example.php │ ├── inheritance-annotations │ └── example.php │ ├── inheritance-xml │ ├── beans.xml │ └── example.php │ ├── inheritance-yaml │ ├── beans.yaml │ └── example.php │ ├── innerBeans │ ├── beans.xml │ └── example.php │ ├── lifecycle │ ├── beans.xml │ └── example.php │ ├── log4php.properties │ ├── loggeraware │ ├── beans.xml │ └── example.php │ ├── methodInjection │ ├── beans.xml │ └── example.php │ ├── mvc-interceptors │ ├── beans.xml │ ├── controllers.xml │ ├── index.php │ ├── log4php.properties │ ├── mvc.xml │ └── views │ │ ├── view.annotated.html │ │ ├── view.exception.html │ │ ├── view.json.html │ │ └── view.some.html │ ├── mvc-smarty │ ├── annotatedControllers │ │ └── someControllers.php │ ├── beans.xml │ ├── controllers.xml │ ├── example.php │ ├── log4php.properties │ ├── mvc.xml │ └── views │ │ ├── view.annotated.tpl │ │ ├── view.exception.tpl │ │ └── view.some.tpl │ ├── mvc-twig │ ├── annotatedControllers │ │ └── someControllers.php │ ├── beans.xml │ ├── controllers.xml │ ├── example.php │ ├── log4php.properties │ ├── mvc.xml │ └── views │ │ ├── view.annotated.html │ │ ├── view.exception.html │ │ └── view.some.html │ ├── mvc │ ├── annotatedControllers │ │ └── someControllers.php │ ├── beans.xml │ ├── controllers.xml │ ├── example.php │ ├── index.php │ ├── log4php.properties │ ├── mvc.xml │ └── views │ │ ├── view.annotated.html │ │ ├── view.exception.html │ │ ├── view.json.html │ │ └── view.some.html │ ├── quickstart │ ├── aspects.xml │ ├── beans.xml │ ├── example.php │ ├── factories.xml │ ├── file.properties │ ├── handlers.php │ ├── other.properties │ └── user.properties │ ├── resources-autoload │ ├── beans.xml │ ├── example.php │ └── file.properties │ ├── resources │ ├── example.php │ └── test.zip │ ├── specialValues │ ├── beans.xml │ └── example.php │ └── yaml │ ├── beans.yaml │ ├── example.php │ ├── file.properties │ └── otherBeans.yaml ├── resources ├── checkstyle.xsl ├── cpd.xslt ├── generatePackageXml.php ├── generatePhar.php ├── pdepend.xsl ├── php.ini.example ├── phpunit_to_surefire.xslt └── pmd.xslt ├── src └── mg │ └── Ding │ ├── Annotation │ ├── Annotation.php │ ├── Collection.php │ ├── Exception │ │ └── AnnotationException.php │ └── Parser.php │ ├── Aspect │ ├── AspectDefinition.php │ ├── AspectManager.php │ ├── IAspectManagerAware.php │ ├── IAspectProvider.php │ ├── IPointcutProvider.php │ ├── Interceptor │ │ ├── AdviceDefinition.php │ │ ├── DispatcherImpl.php │ │ └── IDispatcher.php │ ├── MethodInvocation.php │ ├── PointcutDefinition.php │ └── Proxy.php │ ├── Autoloader │ └── Autoloader.php │ ├── Bean │ ├── BeanConstructorArgumentDefinition.php │ ├── BeanDefinition.php │ ├── BeanPropertyDefinition.php │ ├── Factory │ │ ├── Driver │ │ │ ├── AnnotationDiscovererDriver.php │ │ │ ├── AnnotationInitDestroyMethodDriver.php │ │ │ ├── AnnotationInjectDriver.php │ │ │ ├── AnnotationRequiredDriver.php │ │ │ ├── AnnotationResourceDriver.php │ │ │ ├── AnnotationValueDriver.php │ │ │ ├── MessageSourceDriver.php │ │ │ ├── MethodInjectionDriver.php │ │ │ ├── MvcAnnotationDriver.php │ │ │ └── PropertiesDriver.php │ │ └── Exception │ │ │ ├── BeanFactoryException.php │ │ │ └── InjectByTypeException.php │ ├── IBeanDefinitionProvider.php │ ├── IBeanNameAware.php │ ├── Lifecycle │ │ ├── BeanLifecycle.php │ │ ├── BeanLifecycleManager.php │ │ ├── IAfterAssembleListener.php │ │ ├── IAfterConfigListener.php │ │ ├── IAfterCreateListener.php │ │ ├── IAfterDefinitionListener.php │ │ ├── IBeforeAssembleListener.php │ │ ├── IBeforeCreateListener.php │ │ └── ILifecycleListener.php │ └── Provider │ │ ├── Annotation.php │ │ ├── Core.php │ │ ├── Xml.php │ │ └── Yaml.php │ ├── Cache │ ├── Exception │ │ ├── CacheException.php │ │ └── FileCacheException.php │ ├── ICache.php │ ├── Impl │ │ ├── ApcCacheImpl.php │ │ ├── DummyCacheImpl.php │ │ ├── FileCacheImpl.php │ │ ├── MemcachedCacheImpl.php │ │ └── ZendCacheImpl.php │ └── Locator │ │ └── CacheLocator.php │ ├── Container │ ├── IContainer.php │ ├── IContainerAware.php │ └── Impl │ │ └── ContainerImpl.php │ ├── Exception │ └── DingException.php │ ├── Helpers │ ├── ErrorHandler │ │ └── ErrorInfo.php │ ├── Pagi │ │ ├── PagiExtensionMapper.php │ │ └── PagiHelper.php │ ├── Pami │ │ ├── IPamiEventHandler.php │ │ └── PamiHelper.php │ ├── Properties │ │ ├── IPropertiesHolder.php │ │ └── PropertiesHelper.php │ ├── Syslog │ │ └── SyslogHelper.php │ └── Tcp │ │ ├── Exception │ │ └── TcpException.php │ │ ├── ITcpClientHandler.php │ │ ├── ITcpServerHandler.php │ │ ├── TcpClientHelper.php │ │ ├── TcpPeer.php │ │ └── TcpServerHelper.php │ ├── HttpSession │ └── HttpSession.php │ ├── Logger │ └── ILoggerAware.php │ ├── MessageSource │ ├── IMessageSource.php │ ├── IMessageSourceAware.php │ └── Impl │ │ └── MessageSourceImpl.php │ ├── Mvc │ ├── Action.php │ ├── DispatchInfo.php │ ├── Dispatcher.php │ ├── Exception │ │ └── MvcException.php │ ├── ForwardModelAndView.php │ ├── Http │ │ ├── HttpAction.php │ │ ├── HttpDispatcher.php │ │ ├── HttpExceptionMapper.php │ │ ├── HttpFrontController.php │ │ ├── HttpInterceptor.php │ │ ├── HttpUrlMapper.php │ │ ├── HttpView.php │ │ ├── HttpViewRender.php │ │ ├── HttpViewResolver.php │ │ ├── SmartyViewRender.php │ │ └── TwigViewRender.php │ ├── IHandlerInterceptor.php │ ├── IMapper.php │ ├── IViewRender.php │ ├── IViewResolver.php │ ├── ModelAndView.php │ ├── RedirectModelAndView.php │ └── View.php │ ├── Reflection │ ├── IReflectionFactory.php │ ├── IReflectionFactoryAware.php │ └── ReflectionFactory.php │ └── Resource │ ├── Exception │ └── ResourceException.php │ ├── IResource.php │ ├── IResourceLoader.php │ ├── IResourceLoaderAware.php │ └── Impl │ ├── FilesystemResource.php │ ├── IncludePathResource.php │ └── URLResource.php └── test ├── annotation └── Test_Annotations.php ├── aop ├── annotation │ └── Test_Annotation_AOP.php ├── cache │ └── Test_Cache_AOP.php ├── dispatcher │ └── Test_Dispatcher.php ├── proxy │ └── Test_Proxy.php ├── xml │ └── Test_XML_AOP.php └── yaml │ └── Test_YAML_AOP.php ├── autoloader └── Test_Autoloader.php ├── aware ├── Test_AspectManager_Aware.php ├── Test_BeanName_Aware.php ├── Test_Container_Aware.php ├── Test_Lifecycle_Aware.php ├── Test_Logger_Aware.php ├── Test_MessageSource_Aware.php └── Test_ResourceLoader_Aware.php ├── bootstrap.php ├── cache ├── apc │ ├── Test_IoC_Annotation_Cache_APC.php │ └── Test_IoC_Cache_APC.php ├── dummy │ └── Test_Cache_Dummy.php ├── file │ ├── Test_IoC_Annotation_Cache_File.php │ └── Test_IoC_Cache_File.php ├── locator │ └── Test_Cache_Locator.php ├── memcached │ ├── Test_IoC_Annotation_Cache_Memcached.php │ └── Test_IoC_Cache_Memcached.php └── zfcache │ ├── Test_IoC_Annotation_Cache_ZF.php │ └── Test_IoC_Cache_ZF.php ├── container └── Test_Container.php ├── error └── Test_Error.php ├── event └── Test_Event.php ├── filter ├── xml │ └── Test_XML_Filter.php └── yaml │ └── Test_YAML_Filter.php ├── httpsession └── Test_HttpSession.php ├── i18n └── Test_i18n.php ├── ioc ├── annotation │ ├── Test_AnnotationNamespace_classes.php │ ├── Test_Annotation_IoC.php │ ├── donotscan │ ├── donotscan2.notaphp │ └── somesubdir │ │ └── emptyclassfile.php ├── xml │ └── Test_XML_IoC.php └── yaml │ └── Test_YAML_IoC.php ├── mvc ├── Test_HttpDispatcher.php ├── Test_HttpFrontController.php ├── Test_HttpView.php ├── Test_HttpViewResolver.php └── Test_ModelAndView.php ├── phpunit.xml ├── reflection └── Test_Reflection.php ├── resources-feature ├── Test_Filesystem_Resource.php ├── Test_IncludePath_Resource.php └── Test_URL_Resource.php ├── resources ├── abundle_default.properties ├── abundle_es_AR.properties ├── aop-annotation-simple.xml ├── aop-dispatcher.xml ├── aop-proxy.xml ├── aop-xml-simple.xml ├── aop-yaml-simple.yaml ├── container.xml ├── container.yaml ├── errorBeans.xml ├── events.xml ├── events.yaml ├── filter-xml-simple-holder-string.xml ├── filter-xml-simple-holder.xml ├── filter-xml-simple.xml ├── filter-yaml-file.yaml ├── filter.properties ├── frontcontroller.xml ├── frontcontroller2.xml ├── frontcontroller3.xml ├── i18n.xml ├── inject.xml ├── inject.yaml ├── ioc-xml-invalid.xml ├── ioc-xml-simple.xml ├── ioc-yaml-invalid.yaml ├── ioc-yaml-simple.yaml ├── log4php.properties ├── moreBeans │ ├── moreBeans.xml │ └── moreBeans.yaml ├── mvc.xml ├── resource-autoload.xml ├── shutdownBeans.xml ├── signalBeans.xml ├── someOtherFile.xml ├── someOtherFile.yaml ├── someresource.txt ├── syslog.xml ├── tcpclient.xml ├── tcpclientmock.xml ├── tcpserver.xml └── views │ ├── view.fwd.html │ ├── view.index.html │ ├── view.some.html │ ├── view.someException.html │ ├── view.someOtherException.html │ ├── view.someSmarty.tpl │ └── view.someTwig.html ├── shutdown └── Test_Shutdown.php ├── signal └── Test_Signal.php ├── syslog └── Test_Syslog.php └── tcp ├── Test_TCP_Client.php ├── Test_TCP_Mock.php ├── Test_TCP_Peer.php └── Test_TCP_Server.php /.gitignore: -------------------------------------------------------------------------------- 1 | vendor/* 2 | .buildpath 3 | .settings 4 | .project 5 | log.log 6 | build 7 | bookstore.sqlite 8 | resources/php.ini 9 | 10 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "marcelog/ding", 3 | "type": "framework", 4 | "description": "PHP Dependency Injection based on Spring(tm), with Aspect Oriented Programming, MVC", 5 | "keywords": ["dependency", "injection", "di", "aop", "aspect", "event", "mvc", "tcp", "container", "bean", "jsr", "spring", "xml", "yaml", "annotation"], 6 | "homepage": "http://marcelog.github.com/Ding", 7 | "license": "Apache2", 8 | "authors": [ 9 | { 10 | "name": "Marcelo Gornstein", 11 | "email": "marcelog@gmail.com", 12 | "homepage": "http://marcelog.github.com", 13 | "role": "Developer" 14 | } 15 | ], 16 | "repositories": [ 17 | { 18 | "type": "pear", 19 | "url": "http://pear.apache.org/log4php/" 20 | }], 21 | "autoload": { 22 | "psr-0": { 23 | "Ding": "src/mg" 24 | } 25 | }, 26 | "require": { 27 | "php": ">=5.3.3", 28 | "apache/log4php": "2.3.0" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", 5 | "This file is @generated automatically" 6 | ], 7 | "hash": "ba6087e6a7372960fd986d04c741f64e", 8 | "packages": [ 9 | { 10 | "name": "apache/log4php", 11 | "version": "2.3.0", 12 | "source": { 13 | "type": "git", 14 | "url": "https://git-wip-us.apache.org/repos/asf/logging-log4php.git", 15 | "reference": "8c6df2481cd68d0d211d38f700406c5f0a9de0c2" 16 | }, 17 | "require": { 18 | "php": ">=5.2.7" 19 | }, 20 | "type": "library", 21 | "autoload": { 22 | "classmap": [ 23 | "src/main/php/" 24 | ] 25 | }, 26 | "notification-url": "https://packagist.org/downloads/", 27 | "license": [ 28 | "Apache-2.0" 29 | ], 30 | "description": "A versatile logging framework for PHP", 31 | "homepage": "http://logging.apache.org/log4php/", 32 | "keywords": [ 33 | "log", 34 | "logging", 35 | "php" 36 | ], 37 | "time": "2012-10-26 09:13:25" 38 | } 39 | ], 40 | "packages-dev": [], 41 | "aliases": [], 42 | "minimum-stability": "stable", 43 | "stability-flags": [], 44 | "prefer-stable": false, 45 | "platform": { 46 | "php": ">=5.3.3" 47 | }, 48 | "platform-dev": [] 49 | } 50 | -------------------------------------------------------------------------------- /docs/examples/ErrorHandler/annotated/log4php.properties: -------------------------------------------------------------------------------- 1 | log4php.appender.default.layout = LoggerLayoutSimple 2 | log4php.appender.default = LoggerAppenderDailyFile 3 | log4php.appender.default.file = ./log.log 4 | log4php.rootLogger = INFO, default 5 | log4php.logger.Ding = DEBUG, default 6 | log4php.additivity.Ding = "false" 7 | -------------------------------------------------------------------------------- /docs/examples/ErrorHandler/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/ErrorHandler/example.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | ini_set( 30 | 'include_path', 31 | implode( 32 | PATH_SEPARATOR, 33 | array( 34 | implode(DIRECTORY_SEPARATOR, array('..', '..', '..', 'src', 'mg')), 35 | ini_get('include_path'), 36 | ) 37 | ) 38 | ); 39 | 40 | require_once 'Ding/Autoloader/Autoloader.php'; // Include ding autoloader. 41 | \Ding\Autoloader\Autoloader::register(); // Call autoloader register for ding autoloader. 42 | use Ding\Container\Impl\ContainerImpl; 43 | use Ding\Helpers\ErrorHandler\ErrorInfo; 44 | 45 | error_reporting(E_ALL); 46 | ini_set('display_errorrs', 1); 47 | 48 | /** 49 | * This is our bean. 50 | */ 51 | class MyErrorHandler 52 | { 53 | public function onDingError(ErrorInfo $error) 54 | { 55 | echo "This is your custom error handler: $error\n"; 56 | } 57 | 58 | public function __construct() 59 | { 60 | } 61 | } 62 | 63 | // Here you configure the container, its subcomponents, drivers, etc. 64 | $properties = array( 65 | 'ding' => array( 66 | 'log4php.properties' => __DIR__ . '/../log4php.properties', 67 | 'factory' => array( 68 | 'bdef' => array( // Both of these drivers are optional. They are both included just for the thrill of it. 69 | 'xml' => array('filename' => 'beans.xml'), 70 | ), 71 | ), 72 | ) 73 | ); 74 | $container = ContainerImpl::getInstance($properties); 75 | $excuse = $notExistant; 76 | -------------------------------------------------------------------------------- /docs/examples/PAGI/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | resource://includepath://file.properties 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | ${app1.num} 16 | 17 | 18 | 19 | 20 | 21 | ${app2.num} 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | ${log4php.properties} 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | ${log4php.properties} 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | ${log4php.properties} 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /docs/examples/PAGI/file.properties: -------------------------------------------------------------------------------- 1 | log4php.properties=log4php.properties 2 | app1.num=1 3 | app2.num=2 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/PAGI/log4php.properties: -------------------------------------------------------------------------------- 1 | log4php.appender.default.layout = LoggerLayoutSimple 2 | log4php.appender.default = LoggerAppenderDailyFile 3 | log4php.appender.default.file = /tmp/Ding/log.log 4 | log4php.rootLogger = INFO, default 5 | log4php.logger.Ding = DEBUG, default 6 | log4php.additivity.Ding = "false" 7 | -------------------------------------------------------------------------------- /docs/examples/PAGI/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ################################################################################ 3 | # Sample application to run from your dialplan. 4 | ################################################################################ 5 | 6 | # Location for your log4php.properties 7 | export log4php_properties=/tmp/log4php.properties 8 | export beans_xml_dir=/tmp 9 | 10 | # Make sure this is in the include path. 11 | export PAGIBootstrap=example.php 12 | 13 | # Your copy of PAGI, where src/ is. 14 | pagi=/export/users/marcelog/src/sts/PAGI 15 | ding=/export/users/marcelog/src/sts/Ding 16 | 17 | # Your copy of log4php (optional) 18 | log4php=/export/users/marcelog 19 | 20 | # PHP to run and options 21 | php=/usr/php-5.3/bin/php 22 | phpoptions="-d include_path=${log4php}:${pagi}/src/mg:${ding}/src/mg:${ding}/docs/examples/PAGI" 23 | 24 | # Standard.. the idea is to have a common launcher. 25 | launcher=${ding}/src/mg/Ding/Helpers/Pagi/PagiHelper.php 26 | 27 | # Go! 28 | ${php} ${phpoptions} ${launcher} 29 | 30 | -------------------------------------------------------------------------------- /docs/examples/PAMI/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ${ami.user} 5 | ${ami.pass} 6 | ${ami.host} 7 | ${ami.port} 8 | ${ami.connect_timeout} 9 | ${ami.read_timeout} 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/examples/PhpProperties/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | file://file.properties 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/examples/PhpProperties/file.properties: -------------------------------------------------------------------------------- 1 | php.date.timezone = Navajo 2 | -------------------------------------------------------------------------------- /docs/examples/PropertiesAnnotation/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/RequiredAnnotation/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ${user.name} 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/ResourceAnnotation/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/ShutdownHandler/annotated/log4php.properties: -------------------------------------------------------------------------------- 1 | log4php.appender.default.layout = LoggerLayoutSimple 2 | log4php.appender.default = LoggerAppenderDailyFile 3 | log4php.appender.default.file = ./log.log 4 | log4php.rootLogger = INFO, default 5 | log4php.logger.Ding = DEBUG, default 6 | log4php.additivity.Ding = "false" 7 | -------------------------------------------------------------------------------- /docs/examples/ShutdownHandler/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/SignalHandler/annotated/log4php.properties: -------------------------------------------------------------------------------- 1 | log4php.appender.default.layout = LoggerLayoutSimple 2 | log4php.appender.default = LoggerAppenderDailyFile 3 | log4php.appender.default.file = ./log.log 4 | log4php.rootLogger = INFO, default 5 | log4php.logger.Ding = DEBUG, default 6 | log4php.additivity.Ding = "false" 7 | -------------------------------------------------------------------------------- /docs/examples/SignalHandler/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/SyslogHelper/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ${ident} 5 | ${options} 6 | ${facility} 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/SyslogHelper/example.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | ini_set( 30 | 'include_path', 31 | implode( 32 | PATH_SEPARATOR, 33 | array( 34 | implode(DIRECTORY_SEPARATOR, array('..', '..', '..', 'src', 'mg')), 35 | ini_get('include_path'), 36 | ) 37 | ) 38 | ); 39 | 40 | require_once 'Ding/Autoloader/Autoloader.php'; // Include ding autoloader. 41 | \Ding\Autoloader\Autoloader::register(); // Call autoloader register for ding autoloader. 42 | 43 | use Ding\Container\Impl\ContainerImpl; 44 | 45 | $properties = array( 46 | 'ding' => array( 47 | 'log4php.properties' => __DIR__ . '/../log4php.properties', 48 | 'factory' => array( 49 | 'bdef' => array('xml' => array('filename' => 'beans.xml')), 50 | 'properties' => array( 51 | 'ident' => 'ident', 52 | 'options' => LOG_PID | LOG_ODELAY, 53 | 'facility' => LOG_USER 54 | ) 55 | ), 56 | 'cache' => array( 57 | 'proxy' => array('impl' => 'dummy', 'directory' => '/tmp/Ding/proxy'), 58 | 'bdef' => array('impl' => 'dummy', 'directory' => '/tmp/Ding/bdef'), 59 | 'beans' => array('impl' => 'dummy') 60 | ) 61 | ) 62 | ); 63 | $a = ContainerImpl::getInstance($properties); 64 | $syslog = $a->getBean('Syslog'); 65 | $syslog->emerg('some log'); 66 | $syslog->alert('some log'); 67 | $syslog->critical('some log'); 68 | $syslog->error('some log'); 69 | $syslog->warning('some log'); 70 | $syslog->notice('some log'); 71 | $syslog->info('some log'); 72 | $syslog->debug('some log'); 73 | -------------------------------------------------------------------------------- /docs/examples/TCPClientHelper/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | resource://includepath://file.properties 7 | 8 | 9 | 10 | 11 | 12 | ${tcp.cto} 13 | 14 | 15 | ${tcp.rto} 16 | 17 | 18 | ${tcp.rlen} 19 | 20 | 21 | ${tcp.address} 22 | 23 | 24 | ${tcp.port} 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /docs/examples/TCPClientHelper/file.properties: -------------------------------------------------------------------------------- 1 | tcp.address=127.0.0.1 2 | tcp.port=8881 3 | tcp.cto=100 4 | tcp.rto=500 5 | tcp.rlen=1 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/TCPServerHelper/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | resource://includepath://file.properties 7 | 8 | 9 | 10 | 11 | 12 | ${tcp.backlog} 13 | 14 | 15 | ${tcp.rto} 16 | 17 | 18 | ${tcp.rlen} 19 | 20 | 21 | ${tcp.address} 22 | 23 | 24 | ${tcp.port} 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /docs/examples/TCPServerHelper/file.properties: -------------------------------------------------------------------------------- 1 | tcp.address=127.0.0.1 2 | tcp.port= 8881 3 | tcp.backlog=1 4 | tcp.rto=10000 5 | tcp.rlen=1 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/alias-xml/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/alias-yaml/beans.yaml: -------------------------------------------------------------------------------- 1 | beans: !!map 2 | componentA: 3 | class: ComponentA 4 | name: componentB, componentC 5 | 6 | alias: !!map 7 | componentA: componentD, componentE 8 | 9 | -------------------------------------------------------------------------------- /docs/examples/aop-annotation/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/aop-global/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/examples/aop-regex/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/examples/aop/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/examples/arrays/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 1 7 | 2 8 | 3 9 | 4 10 | 11 | 12 | 13 | 14 | 1 15 | 2 16 | 3 17 | 4 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /docs/examples/basic-with-phar/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ${user.name} 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/basic/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ${user.name} 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/bookstore/README: -------------------------------------------------------------------------------- 1 | NOTE: This is a work in progress. The idea is to show you how to create a 2 | complete ding application (in this case, a web application, but all you'll see 3 | can also be applied to a console application). 4 | 5 | Currently, the mvc has some limitations, but the core point is to show how to 6 | use the container to use DI and AOP quite easily. 7 | 8 | This bookstore will use doctrine as its orm, so you should install doctrine2 9 | if you want to run it. 10 | 11 | 12 | # Create the database: 13 | $ cd docs/examples/bookstore 14 | $ doctrine orm:schema:create 15 | 16 | Now setup your apache or lighttpd with a virtual host for docs/examples/bookstore. 17 | You will need a rewrite rule that maps everything not a file to index.php. This 18 | is an example for lighttpd: 19 | 20 | url.rewrite-if-not-file = ( 21 | ".*\?(.*)$" => "/index.php?$1", 22 | "" => "/index.php" 23 | ) 24 | 25 | For apache, you can use something like this: 26 | RewriteRule ^(.*)$ /index.php/$1 -------------------------------------------------------------------------------- /docs/examples/bookstore/cli-config.php: -------------------------------------------------------------------------------- 1 | register(); 6 | 7 | $classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__); 8 | $classLoader->register(); 9 | 10 | $container = \Ding\Container\Impl\ContainerImpl::getInstance($properties); 11 | $em = $container->getBean('entityManager'); 12 | 13 | $helperSet = new \Symfony\Component\Console\Helper\HelperSet(array( 14 | 'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()), 15 | 'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em) 16 | )); 17 | -------------------------------------------------------------------------------- /docs/examples/bookstore/private/config/application.properties: -------------------------------------------------------------------------------- 1 | application.views = APPLICATION_PUBLIC'/views' 2 | application.language = en_US 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/bookstore/private/config/doctrine.properties: -------------------------------------------------------------------------------- 1 | doctrine.db[driver]=pdo_sqlite 2 | doctrine.db[path]=APPLICATION_DATA"/doctrine/bookstore.sqlite" 3 | doctrine.db[dbname]=bookstore 4 | 5 | doctrine.proxy.dir=APPLICATION_DATA"/doctrine/Proxies" 6 | doctrine.proxy.namespace="Proxies" 7 | doctrine.entity.path=APPLICATION_SRC"/BookStore/Domain/Entity" 8 | -------------------------------------------------------------------------------- /docs/examples/bookstore/private/config/log4php.properties: -------------------------------------------------------------------------------- 1 | log4php.appender.default = LoggerAppenderDailyFile 2 | log4php.appender.default.layout = LoggerLayoutPattern 3 | log4php.appender.default.layout.ConversionPattern = "%d{ISO8601} [%p] %c: %m%n" 4 | log4php.appender.default.file = /tmp/ding-bookstore.log 5 | log4php.rootLogger = DEBUG, default 6 | -------------------------------------------------------------------------------- /docs/examples/bookstore/private/config/php.properties: -------------------------------------------------------------------------------- 1 | php.error_reporting=E_ALL 2 | php.display_errors=1 3 | -------------------------------------------------------------------------------- /docs/examples/bookstore/private/context/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | file://${application.config}/doctrine.properties 7 | file://${application.config}/php.properties 8 | file://${application.config}/application.properties 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/examples/bookstore/private/context/i18n.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | books 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/bookstore/private/context/mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | .phtml 9 | ${application.views} 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | \Exception 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /docs/examples/bookstore/private/context/persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ${doctrine.db} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | ${doctrine.proxy.dir} 27 | 28 | 29 | ${doctrine.proxy.namespace} 30 | 31 | 32 | 33 | 36 | 37 | 38 | ${doctrine.entity.path} 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /docs/examples/bookstore/private/i18n/books_default.properties: -------------------------------------------------------------------------------- 1 | required = "Required argument" 2 | already_exists = "Already exists" 3 | cant_be_empty = "Cant be empty" 4 | change_language = "Change language" 5 | create_a_book = "Create a book" 6 | title = "Title" 7 | description = "Description" 8 | isbn = "ISBN" 9 | has_been_created = "Title: {1} 10 | Description: {2} 11 | ISBN: {3} 12 | Has been created. 13 | " 14 | create = "Create" 15 | back = "Back" 16 | list_books = "Browse Books" 17 | -------------------------------------------------------------------------------- /docs/examples/bookstore/private/i18n/books_es_ES.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcelog/Ding/aad50c28e99509f22c9cb1ba54acbeced3b30c50/docs/examples/bookstore/private/i18n/books_es_ES.properties -------------------------------------------------------------------------------- /docs/examples/bookstore/private/src/BookStore/Aspect/Profiler.php: -------------------------------------------------------------------------------- 1 | logger = $logger; 17 | } 18 | 19 | /** 20 | * @MethodInterceptor(class-expression=.*AbstractService.*,expression=.*) 21 | */ 22 | public function profileDomainServices(MethodInvocation $invocation) 23 | { 24 | $time = microtime(true); 25 | $originalInvocation = $invocation->getOriginalInvocation(); 26 | $ret = $invocation->proceed(); 27 | $total = microtime(true) - $time; 28 | $this->logger->debug( 29 | "Execution of " 30 | . $originalInvocation->getClass() . "::" . $originalInvocation->getMethod() 31 | . " took: " . sprintf('%.5f', $total) 32 | ); 33 | return $ret; 34 | } 35 | } -------------------------------------------------------------------------------- /docs/examples/bookstore/private/src/BookStore/Aspect/Transactional.php: -------------------------------------------------------------------------------- 1 | logger = $logger; 22 | } 23 | 24 | /** 25 | * @MethodInterceptor(class-expression=.*Service.*,expression=.*) 26 | */ 27 | public function manageTransaction(MethodInvocation $methodInvocation) 28 | { 29 | $method = $methodInvocation->getMethod(); 30 | $class = $methodInvocation->getClass(); 31 | if ((strncmp($method, '_', 1) === 0) || (strncmp($method, 'set', 3) === 0)) { 32 | return $methodInvocation->proceed(); 33 | } 34 | $this->logger->debug("Serving for: $class::$method"); 35 | self::$count++; 36 | try 37 | { 38 | if (self::$count === 1) { 39 | $this->logger->debug('Beginning transaction'); 40 | $this->entityManager->beginTransaction(); 41 | } 42 | $result = $methodInvocation->proceed(); 43 | if (self::$count === 1) { 44 | $this->logger->debug('Commiting transaction'); 45 | $this->entityManager->flush(); 46 | $this->entityManager->commit(); 47 | } 48 | self::$count--; 49 | return $result; 50 | } catch(\Exception $exception) { 51 | if (self::$count === 1) { 52 | $this->logger->error('Exception: ' . $exception->getMessage() . ' occurred, rollbacking transaction'); 53 | $this->entityManager->rollback(); 54 | } 55 | self::$count--; 56 | throw $exception; 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /docs/examples/bookstore/private/src/BookStore/Controllers/Exception.php: -------------------------------------------------------------------------------- 1 | add(array('viewName' => 'exception')); 16 | $modelAndView->add(array('exception' => $exception)); 17 | return $modelAndView; 18 | } 19 | } -------------------------------------------------------------------------------- /docs/examples/bookstore/private/src/BookStore/Controllers/Main.php: -------------------------------------------------------------------------------- 1 | add(array('viewName' => 'home')); 17 | return $modelAndView; 18 | } 19 | public function __construct() 20 | { 21 | } 22 | } -------------------------------------------------------------------------------- /docs/examples/bookstore/private/src/BookStore/Controllers/Settings.php: -------------------------------------------------------------------------------- 1 | setAttribute('LANGUAGE', $language); 21 | $modelAndView = new RedirectModelAndView('/'); 22 | return $modelAndView; 23 | } 24 | public function __construct() 25 | { 26 | } 27 | } -------------------------------------------------------------------------------- /docs/examples/bookstore/private/src/BookStore/Domain/Entity/Book.php: -------------------------------------------------------------------------------- 1 | id; 33 | } 34 | 35 | public function getTitle() 36 | { 37 | return $this->title; 38 | } 39 | public function getIsbn() 40 | { 41 | return $this->isbn; 42 | } 43 | 44 | public function getDescription() 45 | { 46 | return $this->description; 47 | } 48 | 49 | public function __construct($title, $isbn, $description) 50 | { 51 | $this->title = $title; 52 | $this->isbn = $isbn; 53 | $this->description = $description; 54 | } 55 | } -------------------------------------------------------------------------------- /docs/examples/bookstore/private/src/BookStore/Domain/Repository/BookRepository.php: -------------------------------------------------------------------------------- 1 | entityManager->getRepository("\BookStore\Domain\Entity\\$name"); 18 | } 19 | 20 | /** @Bean */ 21 | public function bookRepository() 22 | { 23 | return $this->getRepository('Book'); 24 | } 25 | } -------------------------------------------------------------------------------- /docs/examples/bookstore/private/src/BookStore/Domain/Service/AbstractService.php: -------------------------------------------------------------------------------- 1 | entityManager->persist($entity); 21 | } 22 | 23 | public function getByIsbn($isbn) 24 | { 25 | return $this->bookRepository->findOneByIsbn($isbn); 26 | } 27 | 28 | public function getAll() 29 | { 30 | return $this->bookRepository->findAll(); 31 | } 32 | } -------------------------------------------------------------------------------- /docs/examples/bookstore/private/src/BookStore/ErrorHandler/ErrorHandler.php: -------------------------------------------------------------------------------- 1 | logger = $logger; 14 | } 15 | 16 | public function onDingError(ErrorInfo $error) 17 | { 18 | $this->logger->error( 19 | "This is your custom error handler: " . print_r($error, true) 20 | ); 21 | } 22 | } -------------------------------------------------------------------------------- /docs/examples/bookstore/public/bootstrap.php: -------------------------------------------------------------------------------- 1 | array( 20 | 'log4php.properties' => APPLICATION_CFG . '/log4php.properties', 21 | 'factory' => array( 22 | 'bdef' => array( 23 | 'xml' => array('filename' => 'beans.xml', 'directories' => array(APPLICATION_BEANS)), 24 | 'annotation' => array('scanDir' => array(APPLICATION_SRC)) 25 | ), 26 | 'properties' => array('application.config' => APPLICATION_CFG) 27 | ), 28 | 'cache' => array() 29 | ) 30 | ); 31 | -------------------------------------------------------------------------------- /docs/examples/bookstore/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcelog/Ding/aad50c28e99509f22c9cb1ba54acbeced3b30c50/docs/examples/bookstore/public/favicon.ico -------------------------------------------------------------------------------- /docs/examples/bookstore/public/index.php: -------------------------------------------------------------------------------- 1 | getModel(); 3 | ?> 4 |
5 | translate('books', $model['errors']['system']) : ''?>
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
translate('books', 'title'); ?>:translate('books', $model['errors']['title']) : ''?>
translate('books', 'description'); ?>:translate('books', $model['errors']['description']) : ''?>
translate('books', 'isbn'); ?>:translate('books', $model['errors']['isbn']) : ''?>
26 |
27 | translate('books', 'back');?> -------------------------------------------------------------------------------- /docs/examples/bookstore/public/views/created.phtml: -------------------------------------------------------------------------------- 1 | getModel(); 3 | ?> 4 | translate('books', 'has_been_created', array( 6 | $model['title'], $model['description'], $model['isbn'] 7 | )); 8 | ?>
9 | translate('books', 'back');?> 10 | -------------------------------------------------------------------------------- /docs/examples/bookstore/public/views/exception.phtml: -------------------------------------------------------------------------------- 1 | getModel(); 3 | var_dump($data['exception']); 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/bookstore/public/views/footer.phtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/bookstore/public/views/header.phtml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | BookStore 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/bookstore/public/views/home.phtml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/examples/bookstore/public/views/layout.phtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | translate('books', 'title'); ?> 4 | translate('books', 'description'); ?> 5 | translate('books', 'isbn'); ?> 6 | 7 | getModel(); 9 | foreach ($books as $book) { 10 | ?> 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | translate('books', 'back');?> -------------------------------------------------------------------------------- /docs/examples/bookstore/public/views/main.phtml: -------------------------------------------------------------------------------- 1 | getModel(); 3 | $viewName = $model['viewName']; 4 | 5 | include_once __DIR__ . '/' . $viewName . '.phtml'; 6 | -------------------------------------------------------------------------------- /docs/examples/doctrine/README: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | NOTE: THIS EXAMPLE IS NOT FULLY DEVLOPED (WAITING FOR SOME FEATURES). 3 | (However, it shows a nice integration with Doctrin2 framework) 4 | -------------------------------------------------------------------------------- 5 | -------------------------------------------------------------------------------- 6 | Please define DOCTRINE_LIB_PATH in example.php before running it. 7 | -------------------------------------------------------------------------------- 8 | Requirements: 9 | 10 | * PHP requirements: pdo_sqlite3 11 | -------------------------------------------------------------------------------- /docs/examples/doctrine/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | ${doctrine.db.driver} 8 | ${doctrine.db.path} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 23 | 24 | ${doctrine.entity.path} 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | ${doctrine.proxy.dir} 39 | 40 | 41 | ${doctrine.proxy.namespace} 42 | 43 | 44 | ${doctrine.proxy.autogenerate} 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /docs/examples/doctrine/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE Person( 2 | id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 3 | username VARCHAR(50) NOT NULL, 4 | firstName VARCHAR(50) NOT NULL, 5 | lastName VARCHAR(50) NOT NULL 6 | ); 7 | CREATE UNIQUE INDEX Person_username_uniq ON Person (username); 8 | -------------------------------------------------------------------------------- /docs/examples/events/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/events/beans.yaml: -------------------------------------------------------------------------------- 1 | beans: !!map 2 | bean3: 3 | class: Bean3 4 | scope: singleton 5 | listens-on: bean2Created 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/i18n/another_bundle_es.properties: -------------------------------------------------------------------------------- 1 | message.one = "Hola! este es otro mensaje mas {1}" 2 | -------------------------------------------------------------------------------- /docs/examples/i18n/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | default 8 | another_bundle 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/examples/i18n/default_es.properties: -------------------------------------------------------------------------------- 1 | message.example = "Hola! esto es un {1} argumento" 2 | -------------------------------------------------------------------------------- /docs/examples/inheritance-xml/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | blah 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/examples/inheritance-yaml/beans.yaml: -------------------------------------------------------------------------------- 1 | beans: !!map 2 | aDependencyBean: 3 | class: DependencyBean 4 | scope: singleton 5 | aspectBean: 6 | class: AspectBean 7 | scope: singleton 8 | parentBean: 9 | abstract: true 10 | properties: !!map 11 | someProperty: 12 | ref: aDependencyBean 13 | aspects: 14 | aspectA: 15 | pointcuts: 16 | pointcutA: 17 | method: invoke 18 | expression: ^get.* 19 | type: method 20 | ref: aspectBean 21 | childBean: 22 | parent: parentBean 23 | class: MyBean 24 | scope: singleton 25 | properties: !!map 26 | someOtherProperty: 27 | value: blah 28 | -------------------------------------------------------------------------------- /docs/examples/innerBeans/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/lifecycle/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/log4php.properties: -------------------------------------------------------------------------------- 1 | log4php.appender.default.layout = LoggerLayoutSimple 2 | log4php.appender.default = LoggerAppenderDailyFile 3 | log4php.appender.default.file = /tmp/Ding/log.log 4 | log4php.rootLogger = DEBUG, default 5 | log4php.logger.Ding = DEBUG, default 6 | log4php.additivity.Ding = "false" 7 | -------------------------------------------------------------------------------- /docs/examples/loggeraware/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ${user.name} 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/methodInjection/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ${user.name} 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/examples/mvc-interceptors/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/mvc-interceptors/controllers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/mvc-interceptors/log4php.properties: -------------------------------------------------------------------------------- 1 | log4php.appender.default.layout = LoggerLayoutSimple 2 | log4php.appender.default = LoggerAppenderDailyFile 3 | log4php.appender.default.file = /tmp/Ding/log.log 4 | log4php.rootLogger = INFO, default 5 | log4php.logger.Ding = DEBUG, default 6 | log4php.additivity.Ding = "false" 7 | -------------------------------------------------------------------------------- /docs/examples/mvc-interceptors/mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | /MyController 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | view. 23 | .html 24 | ./views 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | \Exception 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /docs/examples/mvc-interceptors/views/view.annotated.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 | hi, i'm a view, and i was served by an annotated controller. 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/mvc-interceptors/views/view.exception.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 | Something bad happened :( 9 | getModel(); 11 | $exception = $exception['exception']; 12 | var_dump($exception); 13 | ?> 14 | 15 | -------------------------------------------------------------------------------- /docs/examples/mvc-interceptors/views/view.json.html: -------------------------------------------------------------------------------- 1 | getModel(); 3 | echo $model['json']; 4 | -------------------------------------------------------------------------------- /docs/examples/mvc-interceptors/views/view.some.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 | hi, i'm a view. And this is what came from the model: 9 | getModel(); 11 | var_dump($model); 12 | ?> 13 |
14 | 15 |
16 | 17 | -------------------------------------------------------------------------------- /docs/examples/mvc-smarty/annotatedControllers/someControllers.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | use Ding\Mvc\SmartyModelAndView; 18 | 19 | /** 20 | * @Controller 21 | * @RequestMapping(url=/MyAnnotatedController) 22 | */ 23 | class AnnotatedController 24 | { 25 | public function anAction() 26 | { 27 | $modelAndView = new SmartyModelAndView('annotated'); 28 | $modelAndView->add(array('arguments' => array('annotatedkey' => 'value'))); 29 | return $modelAndView; 30 | } 31 | } -------------------------------------------------------------------------------- /docs/examples/mvc-smarty/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/mvc-smarty/controllers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/mvc-smarty/log4php.properties: -------------------------------------------------------------------------------- 1 | log4php.appender.default.layout = LoggerLayoutSimple 2 | log4php.appender.default = LoggerAppenderDailyFile 3 | log4php.appender.default.file = /tmp/Ding/log.log 4 | log4php.rootLogger = INFO, default 5 | log4php.logger.Ding = DEBUG, default 6 | log4php.additivity.Ding = "false" 7 | -------------------------------------------------------------------------------- /docs/examples/mvc-smarty/mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | /MyController 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | ${smarty.compile_dir} 22 | ${smarty.config_dir} 23 | ${smarty.cache_dir} 24 | ${smarty.debugging} 25 | 26 | 27 | 28 | 29 | view. 30 | .tpl 31 | ./views 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | \Exception 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /docs/examples/mvc-smarty/views/view.annotated.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | My Annotated controller view 5 | 6 | 7 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/examples/mvc-smarty/views/view.exception.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | My exception view 5 | 6 | 7 | {$exception} 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/mvc-smarty/views/view.some.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | My controller view 5 | 6 | 7 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /docs/examples/mvc-twig/annotatedControllers/someControllers.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | use Ding\Mvc\TwigModelAndView; 18 | 19 | /** 20 | * @Controller 21 | * @RequestMapping(url=/MyAnnotatedController) 22 | */ 23 | class AnnotatedController 24 | { 25 | public function anAction() 26 | { 27 | $modelAndView = new TwigModelAndView('annotated'); 28 | $modelAndView->add(array('annotatedkey' => 'value')); 29 | return $modelAndView; 30 | } 31 | } -------------------------------------------------------------------------------- /docs/examples/mvc-twig/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/mvc-twig/controllers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/mvc-twig/log4php.properties: -------------------------------------------------------------------------------- 1 | log4php.appender.default.layout = LoggerLayoutSimple 2 | log4php.appender.default = LoggerAppenderDailyFile 3 | log4php.appender.default.file = /tmp/Ding/log.log 4 | log4php.rootLogger = INFO, default 5 | log4php.logger.Ding = DEBUG, default 6 | log4php.additivity.Ding = "false" 7 | -------------------------------------------------------------------------------- /docs/examples/mvc-twig/mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | /MyController 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | view. 20 | .html 21 | ./views 22 | 23 | 24 | 25 | 26 | 27 | ${twig.debug} 28 | ${twig.charset} 29 | ${twig.base_template_class} 30 | ${twig.cache} 31 | ${twig.auto_reload} 32 | ${twig.strict_variables} 33 | ${twig.autoescape} 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | \Exception 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /docs/examples/mvc-twig/views/view.annotated.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | My Annotated controller view 5 | 6 | 7 | {% if vars %} 8 | 13 | {% endif %} 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/examples/mvc-twig/views/view.exception.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | My exception view 5 | 6 | 7 | {{ exception }} 8 | {% if vars %} 9 | 14 | {% endif %} 15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/examples/mvc-twig/views/view.some.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | My controller view 5 | 6 | 7 | {% if vars %} 8 | 13 | {% endif %} 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/examples/mvc/annotatedControllers/someControllers.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | use Ding\Mvc\ModelAndView; 18 | 19 | /** 20 | * @Controller 21 | * @RequestMapping(url={/MyAnnotatedController, /MyAliasAnnotatedController}) 22 | */ 23 | class AnnotatedController 24 | { 25 | public function jsonAction($item1, $item2) 26 | { 27 | $options = array( 28 | 'json' => json_encode(func_get_args()) 29 | ); 30 | $modelAndView = new ModelAndView('json', $options); 31 | return $modelAndView; 32 | } 33 | public function anAction() 34 | { 35 | $modelAndView = new ModelAndView('annotated'); 36 | return $modelAndView; 37 | } 38 | } -------------------------------------------------------------------------------- /docs/examples/mvc/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/mvc/controllers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/mvc/index.php: -------------------------------------------------------------------------------- 1 | example.php -------------------------------------------------------------------------------- /docs/examples/mvc/log4php.properties: -------------------------------------------------------------------------------- 1 | log4php.appender.default.layout = LoggerLayoutSimple 2 | log4php.appender.default = LoggerAppenderDailyFile 3 | log4php.appender.default.file = /tmp/Ding/log.log 4 | log4php.rootLogger = INFO, default 5 | log4php.logger.Ding = DEBUG, default 6 | log4php.additivity.Ding = "false" 7 | -------------------------------------------------------------------------------- /docs/examples/mvc/mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | /MyController 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | view. 20 | .html 21 | ./views 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | \Exception 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/examples/mvc/views/view.annotated.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 | hi, i'm a view, and i was served by an annotated controller. 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/mvc/views/view.exception.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 | Something bad happened :( 9 | getModel(); 11 | $exception = $exception['exception']; 12 | var_dump($exception); 13 | ?> 14 | 15 | -------------------------------------------------------------------------------- /docs/examples/mvc/views/view.json.html: -------------------------------------------------------------------------------- 1 | getModel(); 3 | echo $model['json']; 4 | -------------------------------------------------------------------------------- /docs/examples/mvc/views/view.some.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 | hi, i'm a view. And this is what came from the model: 9 | getModel(); 11 | var_dump($model); 12 | ?> 13 |
14 | 15 |
16 | 17 | -------------------------------------------------------------------------------- /docs/examples/quickstart/aspects.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/examples/quickstart/factories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | "001" 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | "001" 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/examples/quickstart/file.properties: -------------------------------------------------------------------------------- 1 | log.dir=/tmp/alogdir 2 | log.file=alog.log 3 | -------------------------------------------------------------------------------- /docs/examples/quickstart/handlers.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | use Ding\Helpers\ErrorHandler\ErrorInfo; 18 | use Ding\Helpers\ErrorHandler\IErrorHandler; 19 | use Ding\Helpers\SignalHandler\ISignalHandler; 20 | use Ding\Helpers\ShutdownHandler\IShutdownHandler; 21 | 22 | /** 23 | * @ErrorHandler 24 | * @SignalHandler 25 | * @ShutdownHandler 26 | * @InitMethod(method=anInitMethod) 27 | * @DestroyMethod(method=aDestroyMethod) 28 | */ 29 | class MyErrorHandler implements IErrorHandler, ISignalHandler, IShutdownHandler 30 | { 31 | public function anInitMethod() 32 | { 33 | echo "Hello, this is the init method of your errorhandler\n"; 34 | } 35 | 36 | public function aDestroyMethod() 37 | { 38 | echo "Hello, this is the *destroy* method of your errorhandler\n"; 39 | } 40 | 41 | public function handleError(ErrorInfo $error) 42 | { 43 | echo "This is your custom error handler: " . print_r($error, true); 44 | } 45 | 46 | public function handleShutdown() 47 | { 48 | echo "This is your custom shutdown handler.\n"; 49 | } 50 | 51 | public function handleSignal($signal) 52 | { 53 | echo "This is your custom signal handler: " . $signal . "\n"; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /docs/examples/quickstart/other.properties: -------------------------------------------------------------------------------- 1 | timezone=America/Buenos_Aires 2 | -------------------------------------------------------------------------------- /docs/examples/quickstart/user.properties: -------------------------------------------------------------------------------- 1 | user.name=nobody 2 | -------------------------------------------------------------------------------- /docs/examples/resources-autoload/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | resource://includepath://file.properties 7 | 8 | 9 | 10 | 11 | resource://${anUrl} 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/examples/resources-autoload/file.properties: -------------------------------------------------------------------------------- 1 | anUrl=http://www.google.com 2 | -------------------------------------------------------------------------------- /docs/examples/resources/test.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcelog/Ding/aad50c28e99509f22c9cb1ba54acbeced3b30c50/docs/examples/resources/test.zip -------------------------------------------------------------------------------- /docs/examples/specialValues/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/examples/yaml/beans.yaml: -------------------------------------------------------------------------------- 1 | beans: !!map 2 | PropertiesHolder: 3 | class: Ding\Helpers\Properties\PropertiesHelper 4 | scope: singleton 5 | properties: !!map 6 | locations: 7 | value: 8 | - value: resource://includepath://file.properties 9 | aspectA: 10 | class: AspectA 11 | scope: singleton 12 | 13 | myBeanName: 14 | class: MyBean 15 | scope: singleton 16 | init-method: init 17 | destroy-method: destroy 18 | depends-on: myOtherBeanName 19 | aspects: 20 | aspectA: 21 | pointcuts: 22 | pointcutA: 23 | method: invoke 24 | expression: targetMethod 25 | type: method 26 | ref: aspectA 27 | aspectB: 28 | pointcuts: 29 | pointcutA: 30 | pointcut-ref: aPointcut 31 | type: method 32 | ref: aspectA 33 | lookup-methods: !!map 34 | aMethod: myOtherBeanName 35 | bMethod: myOtherBeanName 36 | constructor-args: 37 | - a 38 | - !!map 39 | a: b 40 | c: !!map 41 | d: e 42 | - eval: return "hello there\n"; 43 | - ref: myOtherBeanName 44 | properties: !!map 45 | property1: 46 | value: something 47 | property2: 48 | ref: myOtherBeanName 49 | property3: 50 | value: null 51 | property4: 52 | value: false 53 | property5: 54 | value: true 55 | property6: 56 | value: 57 | - value: b 58 | - value: c 59 | property7: 60 | value: !!map 61 | a: 62 | value: b 63 | c: 64 | value: d 65 | d: 66 | ref: myOtherBeanName 67 | e: 68 | value: !!map 69 | a: 70 | value: c 71 | property8: 72 | eval: return "hello there\n"; 73 | property9: 74 | bean: 75 | class: MyInnerBean 76 | scope: singleton 77 | property10: 78 | value: ${user.name} 79 | 80 | pointcuts: !!map 81 | aPointcut: 82 | expression: ^target. 83 | method: invoke 84 | 85 | aspects: !!map 86 | globalAspect: 87 | pointcuts: 88 | apointCut: 89 | pointcut-ref: aPointcut 90 | type: method 91 | ref: aspectA 92 | expression: MyBean 93 | 94 | import: 95 | - otherBeans.yaml 96 | -------------------------------------------------------------------------------- /docs/examples/yaml/file.properties: -------------------------------------------------------------------------------- 1 | user.name=nobody 2 | -------------------------------------------------------------------------------- /docs/examples/yaml/otherBeans.yaml: -------------------------------------------------------------------------------- 1 | beans: !!map 2 | myOtherBeanName: 3 | class: MyOtherBean 4 | scope: singleton 5 | factory-method: getInstance 6 | -------------------------------------------------------------------------------- /resources/generatePhar.php: -------------------------------------------------------------------------------- 1 | '; 16 | $phar = new Phar($argv[1]); 17 | $phar->setAlias('ding.phar'); 18 | $phar->buildFromDirectory($argv[2]); 19 | $phar->setStub($stub); 20 | -------------------------------------------------------------------------------- /resources/php.ini.example: -------------------------------------------------------------------------------- 1 | ;zend_extension=/usr/php/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so 2 | zend_extension=/usr/php-5.3.16/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so 3 | xdebug.auto_trace = On 4 | xdebug.cli_color = 1 5 | 6 | 7 | [PHP] 8 | error_reporting = E_ALL 9 | display_errors = On 10 | display_startup_errors = On 11 | log_errors = On 12 | report_memleaks = On 13 | allow_url_fopen = On 14 | allow_url_include = On 15 | safe_mode = Off 16 | memory_limit = 1024M 17 | short_open_tag = Off 18 | 19 | [Date] 20 | date.timezone = America/Buenos_Aires 21 | 22 | phar.readonly=false 23 | extension=memcached.so 24 | extension=apc.so 25 | extension=yaml.so 26 | 27 | apc.enabled="1" 28 | apc.enable_cli="1" 29 | 30 | -------------------------------------------------------------------------------- /resources/phpunit_to_surefire.xslt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/mg/Ding/Annotation/Exception/AnnotationException.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Annotation\Exception; 30 | 31 | /** 32 | * Exception for annotation related stuff. 33 | * 34 | * PHP Version 5 35 | * 36 | * @category Ding 37 | * @package Annotation 38 | * @subpackage Exception 39 | * @author Marcelo Gornstein 40 | * @license http://marcelog.github.com/ Apache License 2.0 41 | * @link http://marcelog.github.com/ 42 | */ 43 | class AnnotationException extends \Exception 44 | { 45 | 46 | } -------------------------------------------------------------------------------- /src/mg/Ding/Aspect/IAspectManagerAware.php: -------------------------------------------------------------------------------- 1 | 12 | * @license http://marcelog.github.com/ Apache License 2.0 13 | * @link http://marcelog.github.com/ 14 | * 15 | * Copyright 2011 Marcelo Gornstein 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the "License"); 18 | * you may not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * http://www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an "AS IS" BASIS, 25 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | * 29 | */ 30 | namespace Ding\Aspect; 31 | 32 | /** 33 | * Whenever the container instantiates a bean which class implements this 34 | * interface, it will be injected with the current instance of the aspect 35 | * manager. 36 | * 37 | * PHP Version 5 38 | * 39 | * @category Ding 40 | * @package Aspect 41 | * @author Marcelo Gornstein 42 | * @license http://marcelog.github.com/ Apache License 2.0 43 | * @link http://marcelog.github.com/ 44 | */ 45 | interface IAspectManagerAware 46 | { 47 | /** 48 | * Called by the container to inject the aspect manager. 49 | * 50 | * @param AspectManager $aspectManager Aspect Manager instance. 51 | * 52 | * @return void 53 | */ 54 | public function setAspectManager(AspectManager $aspectManager); 55 | } 56 | -------------------------------------------------------------------------------- /src/mg/Ding/Aspect/IAspectProvider.php: -------------------------------------------------------------------------------- 1 | 10 | * @license http://marcelog.github.com/ Apache License 2.0 11 | * @link http://marcelog.github.com/ 12 | * 13 | * Copyright 2011 Marcelo Gornstein 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the "License"); 16 | * you may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | * 27 | */ 28 | namespace Ding\Aspect; 29 | 30 | /** 31 | * Aspect Provider interface. 32 | * 33 | * PHP Version 5 34 | * 35 | * @category Ding 36 | * @package Aspect 37 | * @author Marcelo Gornstein 38 | * @license http://marcelog.github.com/ Apache License 2.0 39 | * @link http://marcelog.github.com/ 40 | * 41 | * Copyright 2011 Marcelo Gornstein 42 | * 43 | * Licensed under the Apache License, Version 2.0 (the "License"); 44 | * you may not use this file except in compliance with the License. 45 | * You may obtain a copy of the License at 46 | * 47 | * http://www.apache.org/licenses/LICENSE-2.0 48 | * 49 | * Unless required by applicable law or agreed to in writing, software 50 | * distributed under the License is distributed on an "AS IS" BASIS, 51 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 52 | * See the License for the specific language governing permissions and 53 | * limitations under the License. 54 | * 55 | */ 56 | interface IAspectProvider 57 | { 58 | /** 59 | * Returns all aspects known to this provider. 60 | * 61 | * @return AspectDefinition[] 62 | */ 63 | public function getAspects(); 64 | } 65 | -------------------------------------------------------------------------------- /src/mg/Ding/Aspect/IPointcutProvider.php: -------------------------------------------------------------------------------- 1 | 10 | * @license http://marcelog.github.com/ Apache License 2.0 11 | * @link http://marcelog.github.com/ 12 | * 13 | * Copyright 2011 Marcelo Gornstein 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the "License"); 16 | * you may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | * 27 | */ 28 | namespace Ding\Aspect; 29 | 30 | /** 31 | * Pointcut Provider interface. 32 | * 33 | * PHP Version 5 34 | * 35 | * @category Ding 36 | * @package Aspect 37 | * @author Marcelo Gornstein 38 | * @license http://marcelog.github.com/ Apache License 2.0 39 | * @link http://marcelog.github.com/ 40 | * 41 | * Copyright 2011 Marcelo Gornstein 42 | * 43 | * Licensed under the Apache License, Version 2.0 (the "License"); 44 | * you may not use this file except in compliance with the License. 45 | * You may obtain a copy of the License at 46 | * 47 | * http://www.apache.org/licenses/LICENSE-2.0 48 | * 49 | * Unless required by applicable law or agreed to in writing, software 50 | * distributed under the License is distributed on an "AS IS" BASIS, 51 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 52 | * See the License for the specific language governing permissions and 53 | * limitations under the License. 54 | * 55 | */ 56 | interface IPointcutProvider 57 | { 58 | /** 59 | * Returns the pointcut definition identified by name, or false. 60 | * 61 | * @param string $name Pointcut id or name. 62 | * 63 | * @return PointcutDefinition 64 | */ 65 | public function getPointcut($name); 66 | } 67 | -------------------------------------------------------------------------------- /src/mg/Ding/Autoloader/Autoloader.php: -------------------------------------------------------------------------------- 1 | 10 | * @license http://marcelog.github.com/ Apache License 2.0 11 | * @link http://marcelog.github.com/ 12 | * 13 | * Copyright 2011 Marcelo Gornstein 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the "License"); 16 | * you may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | * 27 | */ 28 | namespace Ding\Autoloader; 29 | 30 | /** 31 | * Ding autoloader, you will surely need this. 32 | * 33 | * PHP Version 5 34 | * 35 | * @category Ding 36 | * @package Autoloader 37 | * @author Marcelo Gornstein 38 | * @license http://marcelog.github.com/ Apache License 2.0 39 | * @link http://marcelog.github.com/ 40 | */ 41 | class Autoloader 42 | { 43 | /** 44 | * Called by php to load a given class. Returns true if the class was 45 | * successfully loaded. 46 | * 47 | * @return boolean 48 | */ 49 | public static function load($class) 50 | { 51 | $classFile = str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php'; 52 | $file = stream_resolve_include_path($classFile); 53 | if ($file && file_exists($file)) { 54 | require_once $file; 55 | return true; 56 | } 57 | return false; 58 | } 59 | 60 | /** 61 | * You need to use this function to autoregister this loader. 62 | * 63 | * @see spl_autoload_register() 64 | * 65 | * @return boolean 66 | */ 67 | public static function register() 68 | { 69 | return spl_autoload_register('\Ding\Autoloader\Autoloader::load'); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/mg/Ding/Bean/Factory/Exception/BeanFactoryException.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Bean\Factory\Exception; 30 | use Ding\Exception\DingException; 31 | 32 | /** 33 | * Factory exceptions extend this one. 34 | * 35 | * PHP Version 5 36 | * 37 | * @category Ding 38 | * @package Bean 39 | * @subpackage Factory.Exception 40 | * @author Marcelo Gornstein 41 | * @license http://marcelog.github.com/ Apache License 2.0 42 | * @link http://marcelog.github.com/ 43 | */ 44 | class BeanFactoryException extends DingException 45 | { 46 | } -------------------------------------------------------------------------------- /src/mg/Ding/Bean/Factory/Exception/InjectByTypeException.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Bean\Factory\Exception; 30 | 31 | /** 32 | * Thrown when injection by type cant be done. 33 | * 34 | * PHP Version 5 35 | * 36 | * @category Ding 37 | * @package Bean 38 | * @subpackage Factory.Exception 39 | * @author Marcelo Gornstein 40 | * @license http://marcelog.github.com/ Apache License 2.0 41 | * @link http://marcelog.github.com/ 42 | */ 43 | class InjectByTypeException extends BeanFactoryException 44 | { 45 | public function __construct($propertyName, $propertyType, $message) 46 | { 47 | parent::__construct("Cant inject by type $propertyName ($propertyType): $message"); 48 | } 49 | } -------------------------------------------------------------------------------- /src/mg/Ding/Bean/IBeanNameAware.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Bean; 30 | 31 | /** 32 | * Whenever the container instantiates a bean which class implements this 33 | * interface, it will be injected with the bean name. 34 | * 35 | * PHP Version 5 36 | * 37 | * @category Ding 38 | * @package Bean 39 | * @author Marcelo Gornstein 40 | * @license http://marcelog.github.com/ Apache License 2.0 41 | * @link http://marcelog.github.com/ 42 | */ 43 | interface IBeanNameAware 44 | { 45 | /** 46 | * Called by the container to inject the bean name. 47 | * 48 | * @param string $name Bean name. 49 | * 50 | * @return void 51 | */ 52 | public function setBeanName($name); 53 | } 54 | -------------------------------------------------------------------------------- /src/mg/Ding/Bean/Lifecycle/BeanLifecycle.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Bean\Lifecycle; 30 | 31 | /** 32 | * Definition for a bean lifecycle. 33 | * 34 | * PHP Version 5 35 | * 36 | * @category Ding 37 | * @package Bean 38 | * @subpackage Lifecycle 39 | * @author Marcelo Gornstein 40 | * @license http://marcelog.github.com/ Apache License 2.0 41 | * @link http://marcelog.github.com/ 42 | */ 43 | class BeanLifecycle 44 | { 45 | /** 46 | * The bean has just been defined and is about to be created. The definition 47 | * will not change after this step. 48 | * @var integer 49 | */ 50 | const AfterDefinition = 'afterDefinition'; 51 | 52 | /** 53 | * Before calling factory::createBean() 54 | * @var integer 55 | */ 56 | const BeforeCreate = 'beforeCreate'; 57 | 58 | /** 59 | * After calling factory::createBean() 60 | * @var integer 61 | */ 62 | const AfterCreate = 'afterCreate'; 63 | 64 | /** 65 | * Before calling factory::assemble() 66 | * @var integer 67 | */ 68 | const BeforeAssemble = 'beforeAssemble'; 69 | 70 | /** 71 | * After calling factory::assemble() 72 | * @var integer 73 | */ 74 | const AfterAssemble = 'afterAssemble'; 75 | 76 | /** 77 | * Right after configuring everything, ready to be used by the user. 78 | * @var integer 79 | */ 80 | const AfterConfig = 'afterConfig'; 81 | } 82 | -------------------------------------------------------------------------------- /src/mg/Ding/Bean/Lifecycle/IAfterAssembleListener.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Bean\Lifecycle; 30 | 31 | use Ding\Bean\BeanDefinition; 32 | 33 | /** 34 | * Interface for a AfterAssemble lifecycle event. 35 | * 36 | * PHP Version 5 37 | * 38 | * @category Ding 39 | * @package Bean 40 | * @subpackage Lifecycle 41 | * @author Marcelo Gornstein 42 | * @license http://marcelog.github.com/ Apache License 2.0 43 | * @link http://marcelog.github.com/ 44 | */ 45 | interface IAfterAssembleListener extends ILifecycleListener 46 | { 47 | public function afterAssemble($bean, BeanDefinition $beanDefinition); 48 | } -------------------------------------------------------------------------------- /src/mg/Ding/Bean/Lifecycle/IAfterConfigListener.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Bean\Lifecycle; 30 | 31 | /** 32 | * Interface for a AfterConfig lifecycle event. 33 | * 34 | * PHP Version 5 35 | * 36 | * @category Ding 37 | * @package Bean 38 | * @subpackage Lifecycle 39 | * @author Marcelo Gornstein 40 | * @license http://marcelog.github.com/ Apache License 2.0 41 | * @link http://marcelog.github.com/ 42 | */ 43 | interface IAfterConfigListener extends ILifecycleListener 44 | { 45 | public function afterConfig(); 46 | } -------------------------------------------------------------------------------- /src/mg/Ding/Bean/Lifecycle/IAfterCreateListener.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Bean\Lifecycle; 30 | 31 | use Ding\Bean\BeanDefinition; 32 | 33 | /** 34 | * Interface for a AfterCreate lifecycle event. 35 | * 36 | * PHP Version 5 37 | * 38 | * @category Ding 39 | * @package Bean 40 | * @subpackage Lifecycle 41 | * @author Marcelo Gornstein 42 | * @license http://marcelog.github.com/ Apache License 2.0 43 | * @link http://marcelog.github.com/ 44 | */ 45 | interface IAfterCreateListener extends ILifecycleListener 46 | { 47 | public function afterCreate($bean, BeanDefinition $beanDefinition); 48 | } -------------------------------------------------------------------------------- /src/mg/Ding/Bean/Lifecycle/IAfterDefinitionListener.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Bean\Lifecycle; 30 | 31 | use Ding\Bean\BeanDefinition; 32 | 33 | /** 34 | * Interface for a AfterDefinition lifecycle event. 35 | * 36 | * PHP Version 5 37 | * 38 | * @category Ding 39 | * @package Bean 40 | * @subpackage Lifecycle 41 | * @author Marcelo Gornstein 42 | * @license http://marcelog.github.com/ Apache License 2.0 43 | * @link http://marcelog.github.com/ 44 | */ 45 | interface IAfterDefinitionListener extends ILifecycleListener 46 | { 47 | public function afterDefinition(BeanDefinition $bean); 48 | } -------------------------------------------------------------------------------- /src/mg/Ding/Bean/Lifecycle/IBeforeAssembleListener.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Bean\Lifecycle; 30 | 31 | use Ding\Bean\BeanDefinition; 32 | 33 | /** 34 | * Interface for a BeforeAssemble lifecycle event. 35 | * 36 | * PHP Version 5 37 | * 38 | * @category Ding 39 | * @package Bean 40 | * @subpackage Lifecycle 41 | * @author Marcelo Gornstein 42 | * @license http://marcelog.github.com/ Apache License 2.0 43 | * @link http://marcelog.github.com/ 44 | */ 45 | interface IBeforeAssembleListener extends ILifecycleListener 46 | { 47 | public function beforeAssemble($bean, BeanDefinition $beanDefinition); 48 | } -------------------------------------------------------------------------------- /src/mg/Ding/Bean/Lifecycle/IBeforeCreateListener.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Bean\Lifecycle; 30 | 31 | use Ding\Bean\BeanDefinition; 32 | 33 | /** 34 | * Interface for a BeforeCreate lifecycle event. 35 | * 36 | * PHP Version 5 37 | * 38 | * @category Ding 39 | * @package Bean 40 | * @subpackage Lifecycle 41 | * @author Marcelo Gornstein 42 | * @license http://marcelog.github.com/ Apache License 2.0 43 | * @link http://marcelog.github.com/ 44 | */ 45 | interface IBeforeCreateListener extends ILifecycleListener 46 | { 47 | public function beforeCreate(BeanDefinition $beanDefinition); 48 | } -------------------------------------------------------------------------------- /src/mg/Ding/Bean/Lifecycle/ILifecycleListener.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Bean\Lifecycle; 30 | 31 | /** 32 | * Lifecycle listener interface. 33 | * 34 | * PHP Version 5 35 | * 36 | * @category Ding 37 | * @package Bean 38 | * @subpackage Lifecycle 39 | * @author Marcelo Gornstein 40 | * @license http://marcelog.github.com/ Apache License 2.0 41 | * @link http://marcelog.github.com/ 42 | */ 43 | interface ILifecycleListener 44 | { 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/mg/Ding/Cache/Exception/CacheException.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Cache\Exception; 30 | 31 | /** 32 | * Generic cache exception. 33 | * 34 | * PHP Version 5 35 | * 36 | * @category Ding 37 | * @package Cache 38 | * @subpackage Exception 39 | * @author Marcelo Gornstein 40 | * @license http://marcelog.github.com/ Apache License 2.0 41 | * @link http://marcelog.github.com/ 42 | */ 43 | class CacheException extends \Exception 44 | { 45 | } 46 | -------------------------------------------------------------------------------- /src/mg/Ding/Cache/Exception/FileCacheException.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Cache\Exception; 30 | 31 | /** 32 | * Exception for a file cache. 33 | * 34 | * PHP Version 5 35 | * 36 | * @category Ding 37 | * @package Cache 38 | * @subpackage Exception 39 | * @author Marcelo Gornstein 40 | * @license http://marcelog.github.com/ Apache License 2.0 41 | * @link http://marcelog.github.com/ 42 | */ 43 | class FileCacheException extends CacheException 44 | { 45 | } -------------------------------------------------------------------------------- /src/mg/Ding/Cache/ICache.php: -------------------------------------------------------------------------------- 1 | 10 | * @license http://marcelog.github.com/ Apache License 2.0 11 | * @link http://marcelog.github.com/ 12 | * 13 | * Copyright 2011 Marcelo Gornstein 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the "License"); 16 | * you may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | * 27 | */ 28 | namespace Ding\Cache; 29 | use Ding\Cache\ICache; 30 | 31 | /** 32 | * Simple generic cache interface. 33 | * 34 | * PHP Version 5 35 | * 36 | * @category Ding 37 | * @package Cache 38 | * @author Marcelo Gornstein 39 | * @license http://marcelog.github.com/ Apache License 2.0 40 | * @link http://marcelog.github.com/ 41 | */ 42 | interface ICache 43 | { 44 | /** 45 | * Returns a cached value. 46 | * 47 | * @param string $name Key to look for. 48 | * @param boolean &$result True on success, false otherwise. 49 | * 50 | * @return mixed 51 | */ 52 | public function fetch($name, &$result); 53 | 54 | /** 55 | * Stores a key/value. 56 | * 57 | * @param string $name Key to use. 58 | * @param mixed $value Value. 59 | * 60 | * @return boolean 61 | */ 62 | public function store($name, $value); 63 | 64 | /** 65 | * Empties the cache. 66 | * 67 | * @return boolean 68 | */ 69 | public function flush(); 70 | 71 | /** 72 | * Removes a key from the cache. 73 | * 74 | * @param string $name Key to remove. 75 | * 76 | * @return boolean 77 | */ 78 | public function remove($name); 79 | } -------------------------------------------------------------------------------- /src/mg/Ding/Container/IContainerAware.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Container; 30 | 31 | /** 32 | * Whenever the container instantiates a bean which class implements this 33 | * interface, it will be injected with the container instance. 34 | * 35 | * PHP Version 5 36 | * 37 | * @category Ding 38 | * @package Container 39 | * @author Marcelo Gornstein 40 | * @license http://marcelog.github.com/ Apache License 2.0 41 | * @link http://marcelog.github.com/ 42 | */ 43 | interface IContainerAware 44 | { 45 | /** 46 | * Called by the container to inject itself in the bean. 47 | * 48 | * @param IContainer $container The container instance that created this bean. 49 | * 50 | * @return void 51 | */ 52 | public function setContainer(IContainer $container); 53 | } 54 | -------------------------------------------------------------------------------- /src/mg/Ding/Exception/DingException.php: -------------------------------------------------------------------------------- 1 | 10 | * @license http://marcelog.github.com/ Apache License 2.0 11 | * @link http://marcelog.github.com/ 12 | * 13 | * Copyright 2011 Marcelo Gornstein 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the "License"); 16 | * you may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | * 27 | */ 28 | namespace Ding\Exception; 29 | 30 | /** 31 | * All ding exceptions extend this one. 32 | * 33 | * PHP Version 5 34 | * 35 | * @category Ding 36 | * @package Exception 37 | * @author Marcelo Gornstein 38 | * @license http://marcelog.github.com/ Apache License 2.0 39 | * @link http://marcelog.github.com/ 40 | */ 41 | class DingException extends \Exception 42 | { 43 | 44 | } -------------------------------------------------------------------------------- /src/mg/Ding/Helpers/Pami/IPamiEventHandler.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Helpers\Pami; 30 | 31 | use PAMI\Message\Event\EventMessage; 32 | 33 | /** 34 | * PAMI Event handler interface. 35 | * 36 | * PHP Version 5 37 | * 38 | * @category Ding 39 | * @package Helpers 40 | * @subpackage Pami 41 | * @author Marcelo Gornstein 42 | * @license http://marcelog.github.com/ Apache License 2.0 43 | * @link http://marcelog.github.com/ 44 | */ 45 | interface IPamiEventHandler 46 | { 47 | /** 48 | * Will be called for every PAMI event. 49 | * 50 | * @param EventMessage $event PAMI Event message. 51 | * 52 | * @return void 53 | */ 54 | public function handlePamiEvent(EventMessage $event); 55 | } -------------------------------------------------------------------------------- /src/mg/Ding/Helpers/Properties/PropertiesHelper.php: -------------------------------------------------------------------------------- 1 | 12 | * @license http://marcelog.github.com/ Apache License 2.0 13 | * @link http://marcelog.github.com/ 14 | * 15 | * Copyright 2011 Marcelo Gornstein 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the "License"); 18 | * you may not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * http://www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an "AS IS" BASIS, 25 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | * 29 | */ 30 | namespace Ding\Helpers\Properties; 31 | 32 | /** 33 | * This bean will search and replace the properties found in constructor 34 | * arguments and properties. 35 | * 36 | * PHP Version 5 37 | * 38 | * @category Ding 39 | * @package Helpers 40 | * @subpackage PropertiesHelper 41 | * @author Marcelo Gornstein 42 | * @license http://marcelog.github.com/ Apache License 2.0 43 | * @link http://marcelog.github.com/ 44 | */ 45 | class PropertiesHelper implements IPropertiesHolder 46 | { 47 | /** 48 | * IResource[] or string[] 49 | * @var mixed[] 50 | */ 51 | protected $locations = array(); 52 | 53 | /** 54 | * (non-PHPdoc) 55 | * @see Ding\Helpers\Properties.IPropertiesHolder::setLocations() 56 | */ 57 | public function setLocations($locations) 58 | { 59 | $this->locations = $locations; 60 | } 61 | 62 | /** 63 | * (non-PHPdoc) 64 | * @see Ding\Helpers\Properties.IPropertiesHolder::getLocations() 65 | */ 66 | public function getLocations() 67 | { 68 | return $this->locations; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/mg/Ding/Helpers/Tcp/Exception/TcpException.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Helpers\Tcp\Exception; 30 | 31 | use Ding\Exception\DingException; 32 | 33 | /** 34 | * Tcp Helpers exceptions. 35 | * 36 | * PHP Version 5 37 | * 38 | * @category Ding 39 | * @package Helpers 40 | * @subpackage Tcp.Exception 41 | * @author Marcelo Gornstein 42 | * @license http://marcelog.github.com/ Apache License 2.0 43 | * @link http://marcelog.github.com/ 44 | */ 45 | class TcpException extends DingException 46 | { 47 | } -------------------------------------------------------------------------------- /src/mg/Ding/Logger/ILoggerAware.php: -------------------------------------------------------------------------------- 1 | 12 | * @license http://marcelog.github.com/ Apache License 2.0 13 | * @link http://marcelog.github.com/ 14 | * 15 | * Copyright 2011 Marcelo Gornstein 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the "License"); 18 | * you may not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * http://www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an "AS IS" BASIS, 25 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | * 29 | */ 30 | namespace Ding\Logger; 31 | 32 | /** 33 | * Whenever the container instantiates a bean which class implements this 34 | * interface, it will be injected with the logger instance used by the container 35 | * (log4php). 36 | * 37 | * PHP Version 5 38 | * 39 | * @category Ding 40 | * @package Logger 41 | * @author Marcelo Gornstein 42 | * @license http://marcelog.github.com/ Apache License 2.0 43 | * @link http://marcelog.github.com/ 44 | */ 45 | interface ILoggerAware 46 | { 47 | /** 48 | * Called by the container to inject the logger instance. 49 | * 50 | * @param \Logger $logger A log4php instance or dummy logger. 51 | * 52 | * @return void 53 | */ 54 | public function setLogger(\Logger $logger); 55 | } 56 | -------------------------------------------------------------------------------- /src/mg/Ding/MessageSource/IMessageSourceAware.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\MessageSource; 30 | 31 | /** 32 | * Classes that implement this interface will be injected with the current 33 | * message source instance. 34 | * 35 | * PHP Version 5 36 | * 37 | * @category Ding 38 | * @package MessageSource 39 | * @author Marcelo Gornstein 40 | * @license http://marcelog.github.com/ Apache License 2.0 41 | * @link http://marcelog.github.com/ 42 | * 43 | * Copyright 2011 Marcelo Gornstein 44 | * 45 | * Licensed under the Apache License, Version 2.0 (the "License"); 46 | * you may not use this file except in compliance with the License. 47 | * You may obtain a copy of the License at 48 | * 49 | * http://www.apache.org/licenses/LICENSE-2.0 50 | * 51 | * Unless required by applicable law or agreed to in writing, software 52 | * distributed under the License is distributed on an "AS IS" BASIS, 53 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 54 | * See the License for the specific language governing permissions and 55 | * limitations under the License. 56 | * 57 | */ 58 | interface IMessageSourceAware 59 | { 60 | /** 61 | * Set a message source. 62 | * 63 | * @param IMessageSource $messageSource Message source instance. 64 | * 65 | * return void 66 | */ 67 | public function setMessageSource(IMessageSource $messageSource); 68 | } -------------------------------------------------------------------------------- /src/mg/Ding/Mvc/Action.php: -------------------------------------------------------------------------------- 1 | 10 | * @license http://marcelog.github.com/ Apache License 2.0 11 | * @link http://marcelog.github.com/ 12 | * 13 | * Copyright 2011 Marcelo Gornstein 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the "License"); 16 | * you may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | * 27 | */ 28 | namespace Ding\Mvc; 29 | 30 | /** 31 | * Abstract action. 32 | * 33 | * PHP Version 5 34 | * 35 | * @category Ding 36 | * @package Mvc 37 | * @author Marcelo Gornstein 38 | * @license http://marcelog.github.com/ Apache License 2.0 39 | * @link http://marcelog.github.com/ 40 | */ 41 | abstract class Action 42 | { 43 | /** 44 | * Action name, or id, url, path, etc. 45 | * @var string 46 | */ 47 | private $_id; 48 | 49 | /** 50 | * Arguments to this action invocation. 51 | * @var array 52 | */ 53 | private $_arguments; 54 | 55 | /** 56 | * Returns action id/name. 57 | * 58 | * @return string 59 | */ 60 | public function getId() 61 | { 62 | return $this->_id; 63 | } 64 | 65 | /** 66 | * Returns action arguments. 67 | * 68 | * @return array 69 | */ 70 | public function getArguments() 71 | { 72 | return $this->_arguments; 73 | } 74 | 75 | /** 76 | * Constructor. 77 | * 78 | * @param string $id Action name/id/path/url/etc. 79 | * @param array $arguments Action arguments. 80 | * 81 | * @return void 82 | */ 83 | protected function __construct($id, array $arguments = array()) 84 | { 85 | $this->_id = $id; 86 | $this->_arguments = $arguments; 87 | } 88 | } -------------------------------------------------------------------------------- /src/mg/Ding/Mvc/DispatchInfo.php: -------------------------------------------------------------------------------- 1 | 10 | * @license http://marcelog.github.com/ Apache License 2.0 11 | * @link http://marcelog.github.com/ 12 | * 13 | * Copyright 2011 Marcelo Gornstein 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the "License"); 16 | * you may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | * 27 | */ 28 | namespace Ding\Mvc; 29 | 30 | /** 31 | * Dispatch information. 32 | * 33 | * PHP Version 5 34 | * 35 | * @category Ding 36 | * @package Mvc 37 | * @author Marcelo Gornstein 38 | * @license http://marcelog.github.com/ Apache License 2.0 39 | * @link http://marcelog.github.com/ 40 | */ 41 | class DispatchInfo 42 | { 43 | /** 44 | * The action to be handled. 45 | * @var Action 46 | */ 47 | public $action; 48 | 49 | /** 50 | * The handler object. 51 | * @var object 52 | */ 53 | public $handler; 54 | 55 | /** 56 | * Method name to invoke on target 57 | * @var string 58 | */ 59 | public $method; 60 | 61 | /** 62 | * The interceptors, if any. 63 | * @var object[] 64 | */ 65 | public $interceptors; 66 | 67 | public function __construct( 68 | Action $action, $handler, $method, array $interceptors = array() 69 | ) { 70 | $this->action = $action; 71 | $this->handler = $handler; 72 | $this->method = $method; 73 | $this->interceptors = $interceptors; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/mg/Ding/Mvc/Exception/MvcException.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Mvc\Exception; 30 | 31 | /** 32 | * Mvc Family of exceptions. 33 | * 34 | * PHP Version 5 35 | * 36 | * @category Ding 37 | * @package Mvc 38 | * @subpackage Exception 39 | * @author Marcelo Gornstein 40 | * @license http://marcelog.github.com/ Apache License 2.0 41 | * @link http://marcelog.github.com/ 42 | */ 43 | class MvcException extends \Exception 44 | { 45 | } -------------------------------------------------------------------------------- /src/mg/Ding/Mvc/ForwardModelAndView.php: -------------------------------------------------------------------------------- 1 | 10 | * @license http://marcelog.github.com/ Apache License 2.0 11 | * @link http://marcelog.github.com/ 12 | * 13 | * Copyright 2011 Marcelo Gornstein 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the "License"); 16 | * you may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | * 27 | */ 28 | namespace Ding\Mvc; 29 | 30 | /** 31 | * This class is a forward to another model and view. 32 | * 33 | * PHP Version 5 34 | * 35 | * @category Ding 36 | * @package Mvc 37 | * @author Marcelo Gornstein 38 | * @license http://marcelog.github.com/ Apache License 2.0 39 | * @link http://marcelog.github.com/ 40 | */ 41 | class ForwardModelAndView extends ModelAndView 42 | { 43 | } 44 | -------------------------------------------------------------------------------- /src/mg/Ding/Mvc/Http/HttpAction.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Mvc\Http; 30 | 31 | use Ding\Mvc\Action; 32 | 33 | /** 34 | * An http action. It adds a method (get, post, etc). 35 | * 36 | * PHP Version 5 37 | * 38 | * @category Ding 39 | * @package Mvc 40 | * @subpackage Http 41 | * @author Marcelo Gornstein 42 | * @license http://marcelog.github.com/ Apache License 2.0 43 | * @link http://marcelog.github.com/ 44 | */ 45 | class HttpAction extends Action 46 | { 47 | /** 48 | * Method used to trigger this action. 49 | * @var string 50 | */ 51 | private $_method; 52 | 53 | /** 54 | * Sets the method to trigger this action. 55 | * 56 | * @param string $method Method used to trigger this action. 57 | * 58 | * @return void 59 | */ 60 | public function setMethod($method) 61 | { 62 | $this->_method = $method; 63 | } 64 | 65 | /** 66 | * Returns the method to trigger this action. 67 | * 68 | * @return string 69 | */ 70 | public function getMethod() 71 | { 72 | return $this->_method; 73 | } 74 | 75 | /** 76 | * Constructor. 77 | * 78 | * @param string $id Url. 79 | * @param array $arguments Arguments posted (or getted :P). 80 | * 81 | * @return void 82 | */ 83 | public function __construct($id, array $arguments = array()) 84 | { 85 | parent::__construct($id, $arguments); 86 | $this->_method = 'GET'; 87 | } 88 | } -------------------------------------------------------------------------------- /src/mg/Ding/Mvc/Http/HttpDispatcher.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Mvc\Http; 30 | 31 | use Ding\Mvc\IMapper; 32 | use Ding\Mvc\Dispatcher; 33 | use Ding\Mvc\Action; 34 | 35 | /** 36 | * Http dispatcher. Nothing special. 37 | * 38 | * PHP Version 5 39 | * 40 | * @category Ding 41 | * @package Mvc 42 | * @subpackage Http 43 | * @author Marcelo Gornstein 44 | * @license http://marcelog.github.com/ Apache License 2.0 45 | * @link http://marcelog.github.com/ 46 | */ 47 | class HttpDispatcher extends Dispatcher 48 | { 49 | } -------------------------------------------------------------------------------- /src/mg/Ding/Mvc/Http/HttpInterceptor.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Mvc\Http; 30 | 31 | use Ding\Mvc\IHandlerInterceptor; 32 | use Ding\Mvc\Action; 33 | 34 | /** 35 | * A very basic http interceptor. 36 | * 37 | * PHP Version 5 38 | * 39 | * @category Ding 40 | * @package Mvc 41 | * @subpackage Http 42 | * @author Marcelo Gornstein 43 | * @license http://marcelog.github.com/ Apache License 2.0 44 | * @link http://marcelog.github.com/ 45 | */ 46 | class HttpInterceptor implements IHandlerInterceptor 47 | { 48 | public function preHandle(Action $action, $handler) 49 | { 50 | return true; 51 | } 52 | 53 | public function postHandle(Action $action, $handler) 54 | { 55 | return true; 56 | } 57 | } -------------------------------------------------------------------------------- /src/mg/Ding/Mvc/Http/HttpView.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Mvc\Http; 30 | 31 | use Ding\Mvc\View; 32 | use Ding\Mvc\ModelAndView; 33 | 34 | /** 35 | * An http view. 36 | * 37 | * PHP Version 5 38 | * 39 | * @category Ding 40 | * @package Mvc 41 | * @subpackage Http 42 | * @author Marcelo Gornstein 43 | * @license http://marcelog.github.com/ Apache License 2.0 44 | * @link http://marcelog.github.com/ 45 | */ 46 | class HttpView extends View 47 | { 48 | /** 49 | * Full absolute path for this view. 50 | * @var string 51 | */ 52 | private $_path; 53 | 54 | /** 55 | * Returns path for this view. 56 | * 57 | * @return string 58 | */ 59 | public function getPath() 60 | { 61 | return $this->_path; 62 | } 63 | 64 | /** 65 | * Constructor. 66 | * 67 | * @param ModelAndView $modelAndView Use this model representation for this view. 68 | * @param string $path Full absolute path to the file containing this view. 69 | * 70 | * @return void 71 | */ 72 | public function __construct(ModelAndView $modelAndView, $path) 73 | { 74 | parent::__construct($modelAndView); 75 | $this->_path = $path; 76 | } 77 | } -------------------------------------------------------------------------------- /src/mg/Ding/Mvc/Http/TwigViewRender.php: -------------------------------------------------------------------------------- 1 | 10 | * @license http://marcelog.github.com/ Apache License 2.0 11 | * @link http://marcelog.github.com/ 12 | * 13 | * Copyright 2011 Marcelo Gornstein 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the "License"); 16 | * you may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | * 27 | */ 28 | namespace Ding\Mvc\Http; 29 | 30 | use Ding\Mvc\IViewRender; 31 | use Ding\Mvc\View; 32 | 33 | /** 34 | * Twig view render. 35 | * 36 | * PHP Version 5 37 | * 38 | * @category Ding 39 | * @package Mvc 40 | * @author Marcelo Gornstein 41 | * @license http://marcelog.github.com/ Apache License 2.0 42 | * @link http://marcelog.github.com/ 43 | */ 44 | class TwigViewRender implements IViewRender 45 | { 46 | /** 47 | * TWIG options. 48 | * @var string[] 49 | */ 50 | private $_twigOptions = array(); 51 | 52 | /** 53 | * Sets TWIG options. 54 | * 55 | * @param string[] $options TWIG options. 56 | * 57 | * @return void 58 | */ 59 | public function setTwigOptions(array $options) 60 | { 61 | $this->_twigOptions = $options; 62 | } 63 | 64 | /** 65 | * (non-PHPdoc) 66 | * @see Ding\Mvc.IViewRender::render() 67 | */ 68 | public function render(View $view) 69 | { 70 | /** 71 | * @todo is there a better way to do this? 72 | */ 73 | global $modelAndView; 74 | $modelAndView = $view->getModelAndView(); 75 | require_once 'Twig' . DIRECTORY_SEPARATOR . 'Autoloader.php'; 76 | \Twig_Autoloader::register(); 77 | $loader = new \Twig_Loader_Filesystem(dirname($view->getPath())); 78 | $twig = new \Twig_Environment($loader, array($this->_twigOptions)); 79 | $template = $twig->loadTemplate(basename($view->getPath())); 80 | echo $template->render(array('vars' => $modelAndView->getModel())); 81 | } 82 | } -------------------------------------------------------------------------------- /src/mg/Ding/Mvc/IHandlerInterceptor.php: -------------------------------------------------------------------------------- 1 | 10 | * @license http://marcelog.github.com/ Apache License 2.0 11 | * @link http://marcelog.github.com/ 12 | * 13 | * Copyright 2011 Marcelo Gornstein 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the "License"); 16 | * you may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | * 27 | */ 28 | namespace Ding\Mvc; 29 | 30 | /** 31 | * Interface for a request interceptor. 32 | * 33 | * PHP Version 5 34 | * 35 | * @category Ding 36 | * @package Mvc 37 | * @author Marcelo Gornstein 38 | * @license http://marcelog.github.com/ Apache License 2.0 39 | * @link http://marcelog.github.com/ 40 | */ 41 | interface IHandlerInterceptor 42 | { 43 | public function preHandle(Action $action, $handler); 44 | public function postHandle(Action $action, $handler); 45 | } -------------------------------------------------------------------------------- /src/mg/Ding/Mvc/IMapper.php: -------------------------------------------------------------------------------- 1 | 10 | * @license http://marcelog.github.com/ Apache License 2.0 11 | * @link http://marcelog.github.com/ 12 | * 13 | * Copyright 2011 Marcelo Gornstein 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the "License"); 16 | * you may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | * 27 | */ 28 | namespace Ding\Mvc; 29 | 30 | /** 31 | * This will map actions to controllers. 32 | * 33 | * PHP Version 5 34 | * 35 | * @category Ding 36 | * @package Mvc 37 | * @author Marcelo Gornstein 38 | * @license http://marcelog.github.com/ Apache License 2.0 39 | * @link http://marcelog.github.com/ 40 | */ 41 | interface IMapper 42 | { 43 | /** 44 | * Returns a Controller suitable to handle the given action. 45 | * @param IAction $action 46 | * 47 | * @return IController 48 | */ 49 | public function map(Action $action); 50 | 51 | /** 52 | * Configures the mapper with a given map. 53 | * 54 | * @param array $map [0] => Action, [1] => Controller 55 | * 56 | * @return void 57 | */ 58 | public function setMap(array $map); 59 | } -------------------------------------------------------------------------------- /src/mg/Ding/Mvc/IViewRender.php: -------------------------------------------------------------------------------- 1 | 10 | * @license http://marcelog.github.com/ Apache License 2.0 11 | * @link http://marcelog.github.com/ 12 | * 13 | * Copyright 2011 Marcelo Gornstein 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the "License"); 16 | * you may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | * 27 | */ 28 | namespace Ding\Mvc; 29 | 30 | /** 31 | * Interface for the object in charge of setting up the render of the view. 32 | * 33 | * PHP Version 5 34 | * 35 | * @category Ding 36 | * @package Mvc 37 | * @author Marcelo Gornstein 38 | * @license http://marcelog.github.com/ Apache License 2.0 39 | * @link http://marcelog.github.com/ 40 | */ 41 | interface IViewRender 42 | { 43 | /** 44 | * Renders the given view. 45 | * 46 | * @param View $view View to render. 47 | * 48 | * @throws MvcException 49 | * @return View 50 | */ 51 | public function render(View $view); 52 | } -------------------------------------------------------------------------------- /src/mg/Ding/Mvc/IViewResolver.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Mvc; 30 | 31 | /** 32 | * Interface for any object capable of resolving a given ModelAndView to 33 | * an actual View. 34 | * 35 | * PHP Version 5 36 | * 37 | * @category Ding 38 | * @package Mvc 39 | * @author Marcelo Gornstein 40 | * @license http://marcelog.github.com/ Apache License 2.0 41 | * @link http://marcelog.github.com/ 42 | */ 43 | interface IViewResolver 44 | { 45 | /** 46 | * Maps a given ModelAndView to a corresponding view so it can be rendered. 47 | * 48 | * @param ModelAndView $modelAndView 49 | * 50 | * @throws MvcException 51 | * @return View 52 | */ 53 | public function resolve(ModelAndView $modelAndView); 54 | } -------------------------------------------------------------------------------- /src/mg/Ding/Mvc/RedirectModelAndView.php: -------------------------------------------------------------------------------- 1 | 10 | * @license http://marcelog.github.com/ Apache License 2.0 11 | * @link http://marcelog.github.com/ 12 | * 13 | * Copyright 2011 Marcelo Gornstein 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the "License"); 16 | * you may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | * 27 | */ 28 | namespace Ding\Mvc; 29 | 30 | /** 31 | * This class is a forward to another model and view. 32 | * 33 | * PHP Version 5 34 | * 35 | * @category Ding 36 | * @package Mvc 37 | * @author Marcelo Gornstein 38 | * @license http://marcelog.github.com/ Apache License 2.0 39 | * @link http://marcelog.github.com/ 40 | */ 41 | class RedirectModelAndView extends ModelAndView 42 | { 43 | } 44 | -------------------------------------------------------------------------------- /src/mg/Ding/Mvc/View.php: -------------------------------------------------------------------------------- 1 | 10 | * @license http://marcelog.github.com/ Apache License 2.0 11 | * @link http://marcelog.github.com/ 12 | * 13 | * Copyright 2011 Marcelo Gornstein 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the "License"); 16 | * you may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | * 27 | */ 28 | namespace Ding\Mvc; 29 | 30 | /** 31 | * A generic view. 32 | * 33 | * PHP Version 5 34 | * 35 | * @category Ding 36 | * @package Mvc 37 | * @author Marcelo Gornstein 38 | * @license http://marcelog.github.com/ Apache License 2.0 39 | * @link http://marcelog.github.com/ 40 | */ 41 | abstract class View 42 | { 43 | /** 44 | * View name. 45 | * @var ModelAndView 46 | */ 47 | private $_modelAndView; 48 | 49 | /** 50 | * Returns this view name. 51 | * 52 | * @return string 53 | */ 54 | public function getModelAndView() 55 | { 56 | return $this->_modelAndView; 57 | } 58 | 59 | /** 60 | * Constructor. 61 | * 62 | * @param ModelAndView $modelAndView Model to render. 63 | * 64 | * @return void 65 | */ 66 | protected function __construct(ModelAndView $modelAndView) 67 | { 68 | $this->_modelAndView = $modelAndView; 69 | } 70 | } -------------------------------------------------------------------------------- /src/mg/Ding/Reflection/IReflectionFactoryAware.php: -------------------------------------------------------------------------------- 1 | 10 | * @license http://marcelog.github.com/ Apache License 2.0 11 | * @link http://marcelog.github.com/ 12 | * 13 | * Copyright 2011 Marcelo Gornstein 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the "License"); 16 | * you may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | * 27 | */ 28 | namespace Ding\Reflection; 29 | 30 | /** 31 | * Implement this interface to be injected with the reflection factory. 32 | * 33 | * PHP Version 5 34 | * 35 | * @category Ding 36 | * @package Reflection 37 | * @author Marcelo Gornstein 38 | * @license http://marcelog.github.com/ Apache License 2.0 39 | * @link http://marcelog.github.com/ 40 | */ 41 | interface IReflectionFactoryAware 42 | { 43 | public function setReflectionFactory(IReflectionFactory $reflectionFactory); 44 | } 45 | -------------------------------------------------------------------------------- /src/mg/Ding/Resource/Exception/ResourceException.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Resource\Exception; 30 | use Ding\Exception\DingException; 31 | 32 | /** 33 | * A generic Resource exception. 34 | * 35 | * PHP Version 5 36 | * 37 | * @category Ding 38 | * @package Resource 39 | * @subpackage Exception 40 | * @author Marcelo Gornstein 41 | * @license http://marcelog.github.com/ Apache License 2.0 42 | * @link http://marcelog.github.com/ 43 | * 44 | * Copyright 2011 Marcelo Gornstein 45 | * 46 | * Licensed under the Apache License, Version 2.0 (the "License"); 47 | * you may not use this file except in compliance with the License. 48 | * You may obtain a copy of the License at 49 | * 50 | * http://www.apache.org/licenses/LICENSE-2.0 51 | * 52 | * Unless required by applicable law or agreed to in writing, software 53 | * distributed under the License is distributed on an "AS IS" BASIS, 54 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 55 | * See the License for the specific language governing permissions and 56 | * limitations under the License. 57 | * 58 | */ 59 | class ResourceException extends DingException 60 | { 61 | } -------------------------------------------------------------------------------- /src/mg/Ding/Resource/IResourceLoader.php: -------------------------------------------------------------------------------- 1 | 10 | * @license http://marcelog.github.com/ Apache License 2.0 11 | * @link http://marcelog.github.com/ 12 | * 13 | * Copyright 2011 Marcelo Gornstein 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the "License"); 16 | * you may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | * 27 | */ 28 | namespace Ding\Resource; 29 | 30 | /** 31 | * Resource Loader contract. 32 | * 33 | * PHP Version 5 34 | * 35 | * @category Ding 36 | * @package Resource 37 | * @author Marcelo Gornstein 38 | * @license http://marcelog.github.com/ Apache License 2.0 39 | * @link http://marcelog.github.com/ 40 | * 41 | * Copyright 2011 Marcelo Gornstein 42 | * 43 | * Licensed under the Apache License, Version 2.0 (the "License"); 44 | * you may not use this file except in compliance with the License. 45 | * You may obtain a copy of the License at 46 | * 47 | * http://www.apache.org/licenses/LICENSE-2.0 48 | * 49 | * Unless required by applicable law or agreed to in writing, software 50 | * distributed under the License is distributed on an "AS IS" BASIS, 51 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 52 | * See the License for the specific language governing permissions and 53 | * limitations under the License. 54 | * 55 | */ 56 | interface IResourceLoader 57 | { 58 | /** 59 | * Returns a resource. 60 | * 61 | * @param string $location Location for the resource. 62 | * @param resource $context Optional context created with stream_context_create() 63 | * 64 | * @throws ResourceException 65 | * @return IResource 66 | */ 67 | public function getResource($location, $context = false); 68 | } -------------------------------------------------------------------------------- /src/mg/Ding/Resource/IResourceLoaderAware.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | namespace Ding\Resource; 30 | 31 | /** 32 | * Classes that implement this interface will be injected with the resource 33 | * loader instance. 34 | * 35 | * PHP Version 5 36 | * 37 | * @category Ding 38 | * @package Resource 39 | * @author Marcelo Gornstein 40 | * @license http://marcelog.github.com/ Apache License 2.0 41 | * @link http://marcelog.github.com/ 42 | * 43 | * Copyright 2011 Marcelo Gornstein 44 | * 45 | * Licensed under the Apache License, Version 2.0 (the "License"); 46 | * you may not use this file except in compliance with the License. 47 | * You may obtain a copy of the License at 48 | * 49 | * http://www.apache.org/licenses/LICENSE-2.0 50 | * 51 | * Unless required by applicable law or agreed to in writing, software 52 | * distributed under the License is distributed on an "AS IS" BASIS, 53 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 54 | * See the License for the specific language governing permissions and 55 | * limitations under the License. 56 | * 57 | */ 58 | interface IResourceLoaderAware 59 | { 60 | /** 61 | * This will inject the resource loader. 62 | * 63 | * @param IResourceLoader $resourceLoader Resource loader instance. 64 | * 65 | * @return void 66 | */ 67 | public function setResourceLoader(IResourceLoader $resourceLoader); 68 | } -------------------------------------------------------------------------------- /test/autoloader/Test_Autoloader.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | 30 | /** 31 | * This class will test the autoloader. 32 | * 33 | * PHP Version 5 34 | * 35 | * @category Ding 36 | * @package Test 37 | * @subpackage Autoloader 38 | * @author Marcelo Gornstein 39 | * @license http://marcelog.github.com/ Apache License 2.0 40 | * @link http://marcelog.github.com/ 41 | */ 42 | class Test_Autoloader extends PHPUnit_Framework_TestCase 43 | { 44 | public function dummyAutoloader() 45 | { 46 | return true; 47 | } 48 | 49 | /** 50 | * @test 51 | */ 52 | public function can_register() 53 | { 54 | \Ding\Autoloader\Autoloader::register(); // Call autoloader register for ding autoloader. 55 | spl_autoload_register(array($this, 'dummyAutoloader')); 56 | $this->assertFalse(class_exists('A\B\C', true)); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /test/bootstrap.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | 30 | use Ding\Cache\Locator\CacheLocator; 31 | use Ding\Cache\Exception\CacheException; 32 | 33 | /** 34 | * This class will test the cache locator. 35 | * 36 | * PHP Version 5 37 | * 38 | * @category Ding 39 | * @package Test 40 | * @subpackage Cache.Locator 41 | * @author Marcelo Gornstein 42 | * @license http://marcelog.github.com/ Apache License 2.0 43 | * @link http://marcelog.github.com/ 44 | */ 45 | class Test_Cache_Locator extends PHPUnit_Framework_TestCase 46 | { 47 | /** 48 | * @test 49 | * @expectedException Ding\Cache\Exception\CacheException 50 | */ 51 | public function cannot_get_invalid_cache() 52 | { 53 | CacheLocator::configure(array('bdef' => array('impl' => 'asdads'))); 54 | CacheLocator::getDefinitionsCacheInstance(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /test/httpsession/Test_HttpSession.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | 30 | use Ding\HttpSession\HttpSession; 31 | 32 | /** 33 | * This class will test the HttpSession. 34 | * 35 | * PHP Version 5 36 | * 37 | * @category Ding 38 | * @package Test 39 | * @subpackage Httpsession 40 | * @author Marcelo Gornstein 41 | * @license http://marcelog.github.com/ Apache License 2.0 42 | * @link http://marcelog.github.com/ 43 | */ 44 | class Test_HttpSession extends PHPUnit_Framework_TestCase 45 | { 46 | /** 47 | * @test 48 | */ 49 | public function can_use_session() 50 | { 51 | $session = HttpSession::getSession(); 52 | $session->destroy(); 53 | } 54 | 55 | /** 56 | * @test 57 | */ 58 | public function can_return_false_on_invalid_attribute() 59 | { 60 | $session = HttpSession::getSession(); 61 | $this->assertFalse($session->getAttribute('notexistant')); 62 | } 63 | 64 | /** 65 | * @test 66 | */ 67 | public function can_use_attributes() 68 | { 69 | $session = HttpSession::getSession(); 70 | $session->setAttribute('foo', 'bar'); 71 | $this->assertEquals($session->getAttribute('foo'), 'bar'); 72 | $this->assertTrue($session->hasAttribute('foo')); 73 | } 74 | } -------------------------------------------------------------------------------- /test/ioc/annotation/Test_AnnotationNamespace_classes.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | 30 | use Ding\Mvc\ModelAndView; 31 | use Ding\Mvc\RedirectModelAndView; 32 | use Ding\Mvc\ForwardModelAndView; 33 | use Ding\Container\Impl\ContainerImpl; 34 | 35 | /** 36 | * This class will test the ModelAndview. 37 | * 38 | * PHP Version 5 39 | * 40 | * @category Ding 41 | * @package Test 42 | * @subpackage mvc 43 | * @author Marcelo Gornstein 44 | * @license http://marcelog.github.com/ Apache License 2.0 45 | * @link http://marcelog.github.com/ 46 | */ 47 | class Test_ModelAndView extends PHPUnit_Framework_TestCase 48 | { 49 | /** 50 | * @test 51 | */ 52 | public function can_get_set_model() 53 | { 54 | $mav = new ModelAndView('name'); 55 | $mav->add(array('key1' => 'value1')); 56 | $model = $mav->getModel(); 57 | $this->assertEquals($model['key1'], 'value1'); 58 | } 59 | 60 | /** 61 | * @test 62 | */ 63 | public function can_redirect_mav() 64 | { 65 | $mav = new RedirectModelAndView('name'); 66 | $mav->add(array('key1' => 'value1')); 67 | $model = $mav->getModel(); 68 | $this->assertEquals($model['key1'], 'value1'); 69 | } 70 | 71 | /** 72 | * @test 73 | */ 74 | public function can_forward_mav() 75 | { 76 | $mav = new ForwardModelAndView('name'); 77 | $mav->add(array('key1' => 'value1')); 78 | $model = $mav->getModel(); 79 | $this->assertEquals($model['key1'], 'value1'); 80 | } 81 | } -------------------------------------------------------------------------------- /test/resources/abundle_default.properties: -------------------------------------------------------------------------------- 1 | message.some = "This is a test message, arg1={1} arg2={2} arg3={3}" -------------------------------------------------------------------------------- /test/resources/abundle_es_AR.properties: -------------------------------------------------------------------------------- 1 | message.some = "Este es un mensaje de prueba, arg1={1} arg2={2} arg3={3}" -------------------------------------------------------------------------------- /test/resources/aop-annotation-simple.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /test/resources/aop-dispatcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /test/resources/aop-proxy.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/resources/aop-xml-simple.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /test/resources/aop-yaml-simple.yaml: -------------------------------------------------------------------------------- 1 | pointcuts: !!map 2 | aPointcut: 3 | expression: ^.+ 4 | method: invoke 5 | 6 | beans: !!map 7 | invalidAspectType: 8 | class: ClassSimpleAOPYAML 9 | scope: singleton 10 | aspects: 11 | aspectA: 12 | pointcuts: 13 | pointcutA: 14 | method: invoke 15 | expression: ^.+ 16 | type: blah 17 | ref: aspectBean 18 | 19 | aspectBean: 20 | class: ClassSimpleAOPYAMLAspect 21 | scope: singleton 22 | 23 | methodIntercepted: 24 | class: ClassSimpleAOPYAML 25 | scope: singleton 26 | aspects: 27 | aspectA: 28 | pointcuts: 29 | pointcutA: 30 | id: some 31 | method: invoke 32 | expression: targetMethod 33 | type: method 34 | ref: aspectBean 35 | 36 | multipleMethodIntercepted: 37 | class: ClassSimpleAOPYAML2 38 | scope: singleton 39 | aspects: 40 | aspectA: 41 | pointcuts: 42 | pointcutA: 43 | method: invoke 44 | expression: ^.+ 45 | type: method 46 | ref: aspectBean 47 | 48 | globalAspectedBeanA: 49 | class: ClassSimpleAOPYAMLGlobalSomething 50 | scope: singleton 51 | 52 | globalAspectedBeanB: 53 | class: ClassSimpleAOPYAMLGlobalSomethingElse 54 | scope: singleton 55 | 56 | globalPointcut: 57 | class: ClassSimpleAOPYAML3 58 | scope: singleton 59 | aspects: 60 | aspectA: 61 | pointcuts: 62 | pointcutA: 63 | pointcut-ref: aPointcut 64 | type: method 65 | ref: aspectBean 66 | 67 | aspectExceptionBean: 68 | class: ClassSimpleAOPExceptionYAMLAspect 69 | scope: singleton 70 | 71 | exceptionIntercepted: 72 | class: ClassSimpleAOPExceptionYAML 73 | scope: singleton 74 | aspects: 75 | aspectA: 76 | pointcuts: 77 | pointcutA: 78 | expression: ^.+ 79 | method: invoke 80 | type: exception 81 | ref: aspectExceptionBean 82 | 83 | aspects: !!map 84 | globalAspect: 85 | pointcuts: 86 | apointCut: 87 | method: invoke 88 | expression: ^.+ 89 | type: method 90 | ref: aspectBean 91 | expression: ClassSimpleAOPYAMLGlobal.+ 92 | -------------------------------------------------------------------------------- /test/resources/container.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | value 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/resources/container.yaml: -------------------------------------------------------------------------------- 1 | beans: 2 | unusedBean: 3 | class: ${customImplementation} 4 | -------------------------------------------------------------------------------- /test/resources/errorBeans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/resources/events.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/resources/events.yaml: -------------------------------------------------------------------------------- 1 | beans: !!map 2 | eventBean3: 3 | class: EventBean3 4 | scope: singleton 5 | listens-on: beanCreated 6 | 7 | -------------------------------------------------------------------------------- /test/resources/filter-xml-simple-holder-string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | file://resources/${file} 7 | 8 | 9 | 10 | 11 | ${someproperty}${a.b.value} 12 | ${someproperty}${a.b.value} 13 | ${someproperty}${a.b.value} 14 | ${someproperty}${a.b.value} 15 | 16 | -------------------------------------------------------------------------------- /test/resources/filter-xml-simple-holder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | resource://includepath://${file} 7 | 8 | 9 | 10 | 11 | ${someproperty}${a.b.value} 12 | ${someproperty}${a.b.value} 13 | ${someproperty}${a.b.value} 14 | ${someproperty}${a.b.value} 15 | 16 | -------------------------------------------------------------------------------- /test/resources/filter-xml-simple.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ${a.b.value} 5 | ${a.b.value} 6 | ${a.b.value} 7 | ${a.b.value} 8 | ${an.array.value} 9 | 10 | -------------------------------------------------------------------------------- /test/resources/filter-yaml-file.yaml: -------------------------------------------------------------------------------- 1 | beans: !!map 2 | aBean: 3 | class: ClassSimpleYAMLFilter 4 | scope: singleton 5 | constructor-args: 6 | - value: ${a.b.value} 7 | properties: !!map 8 | value: 9 | value: ${a.b.value} 10 | -------------------------------------------------------------------------------- /test/resources/filter.properties: -------------------------------------------------------------------------------- 1 | someproperty=indeedavalue 2 | php.date.timezone=Navajo -------------------------------------------------------------------------------- /test/resources/frontcontroller.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | /MyController 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | \OtherException 24 | 25 | 26 | 27 | 28 | 29 | \NewException 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | ${twig.debug} 40 | ${twig.charset} 41 | ${twig.base_template_class} 42 | ${twig.cache} 43 | ${twig.auto_reload} 44 | ${twig.strict_variables} 45 | ${twig.autoescape} 46 | 47 | 48 | 49 | 50 | view. 51 | .html 52 | ${prefix}/views 53 | 54 | -------------------------------------------------------------------------------- /test/resources/frontcontroller2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | /MyController 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | view. 20 | .html 21 | ${prefix}/views 22 | 23 | -------------------------------------------------------------------------------- /test/resources/frontcontroller3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | /MyController 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | \OtherException 24 | 25 | 26 | 27 | 28 | 29 | \NewException 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | ${smarty.compile_dir} 40 | ${smarty.config_dir} 41 | ${smarty.cache_dir} 42 | ${smarty.debugging} 43 | 44 | 45 | 46 | 47 | view. 48 | .tpl 49 | ${prefix}/views 50 | 51 | -------------------------------------------------------------------------------- /test/resources/i18n.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | abundle 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/resources/inject.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /test/resources/inject.yaml: -------------------------------------------------------------------------------- 1 | beans: 2 | injectCandidate1: 3 | class: AnXmlInjectCandidate 4 | primary: true 5 | injectCandidate2: 6 | class: AnXmlInjectCandidate2 7 | -------------------------------------------------------------------------------- /test/resources/ioc-xml-invalid.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /test/resources/ioc-yaml-invalid.yaml: -------------------------------------------------------------------------------- 1 | @#$beans: 2 | 234 bean: 3 | - - 4 | 5 | - a: -------------------------------------------------------------------------------- /test/resources/log4php.properties: -------------------------------------------------------------------------------- 1 | log4php.appender.default = LoggerAppenderFile 2 | log4php.appender.default.layout = LoggerLayoutPattern 3 | log4php.appender.default.layout.ConversionPattern = "%d{ISO8601} [%p] %c: %m"%n 4 | log4php.appender.default.file = ../build/log.log 5 | log4php.rootLogger = DEBUG, default 6 | -------------------------------------------------------------------------------- /test/resources/moreBeans/moreBeans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/resources/moreBeans/moreBeans.yaml: -------------------------------------------------------------------------------- 1 | beans: !!map 2 | aSecretBean: 3 | class: ClassSimpleYAML9 4 | scope: singleton 5 | properties: !!map 6 | secretBean: 7 | ref: aSimpleSingletonBean -------------------------------------------------------------------------------- /test/resources/resource-autoload.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | resource://${aResource} 5 | resource://${aResource} 6 | resource://${aResource} 7 | resource://${aResource} 8 | 9 | -------------------------------------------------------------------------------- /test/resources/shutdownBeans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/resources/signalBeans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/resources/someOtherFile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/resources/someOtherFile.yaml: -------------------------------------------------------------------------------- 1 | beans: !!map 2 | importedBean: 3 | class: ClassSimpleYAML5 4 | scope: singleton 5 | constructor-args: 6 | - ref: aSimpleSingletonBean -------------------------------------------------------------------------------- /test/resources/someresource.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/resources/syslog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ${ident} 5 | ${options} 6 | ${facility} 7 | 8 | -------------------------------------------------------------------------------- /test/resources/views/view.fwd.html: -------------------------------------------------------------------------------- 1 | hi there, im a forwarded view -------------------------------------------------------------------------------- /test/resources/views/view.index.html: -------------------------------------------------------------------------------- 1 | hi there. im the default action -------------------------------------------------------------------------------- /test/resources/views/view.some.html: -------------------------------------------------------------------------------- 1 | hi there -------------------------------------------------------------------------------- /test/resources/views/view.someException.html: -------------------------------------------------------------------------------- 1 | damn exception -------------------------------------------------------------------------------- /test/resources/views/view.someOtherException.html: -------------------------------------------------------------------------------- 1 | damn other exception -------------------------------------------------------------------------------- /test/resources/views/view.someSmarty.tpl: -------------------------------------------------------------------------------- 1 | hi there, im a smarty view {$a} -------------------------------------------------------------------------------- /test/resources/views/view.someTwig.html: -------------------------------------------------------------------------------- 1 | hi there, im a twig view -------------------------------------------------------------------------------- /test/syslog/Test_Syslog.php: -------------------------------------------------------------------------------- 1 | 11 | * @license http://marcelog.github.com/ Apache License 2.0 12 | * @link http://marcelog.github.com/ 13 | * 14 | * Copyright 2011 Marcelo Gornstein 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | * 28 | */ 29 | 30 | use Ding\Container\Impl\ContainerImpl; 31 | 32 | /** 33 | * This class will test the syslog feature. 34 | * 35 | * PHP Version 5 36 | * 37 | * @category Ding 38 | * @package Test 39 | * @subpackage Syslog 40 | * @author Marcelo Gornstein 41 | * @license http://marcelog.github.com/ Apache License 2.0 42 | * @link http://marcelog.github.com/ 43 | */ 44 | class Test_Syslog extends PHPUnit_Framework_TestCase 45 | { 46 | /** 47 | * @test 48 | */ 49 | public function can_use_syslog() 50 | { 51 | $properties = array( 52 | 'ding' => array( 53 | 'log4php.properties' => RESOURCES_DIR . DIRECTORY_SEPARATOR . 'log4php.properties', 54 | 'factory' => array( 55 | 'bdef' => array( 56 | 'xml' => array('filename' => 'syslog.xml', 'directories' => array(RESOURCES_DIR)) 57 | ) 58 | ) 59 | ) 60 | ); 61 | $container = ContainerImpl::getInstance($properties); 62 | $syslog = $container->getBean('syslog'); 63 | $syslog->open(); 64 | $syslog->emerg('some log'); 65 | $syslog->alert('some log'); 66 | $syslog->critical('some log'); 67 | $syslog->error('some log'); 68 | $syslog->warning('some log'); 69 | $syslog->notice('some log'); 70 | $syslog->info('some log'); 71 | $syslog->debug('some log'); 72 | $syslog->close(); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /test/tcp/Test_TCP_Peer.php: -------------------------------------------------------------------------------- 1 | 12 | * @license http://marcelog.github.com/ Apache License 2.0 13 | * @link http://marcelog.github.com/ 14 | * 15 | * Copyright 2011 Marcelo Gornstein 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the "License"); 18 | * you may not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * http://www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an "AS IS" BASIS, 25 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | * 29 | */ 30 | use Ding\Container\Impl\ContainerImpl; 31 | 32 | /** 33 | * This class will test the Tcp Peer. 34 | * 35 | * PHP Version 5 36 | * 37 | * @category Ding 38 | * @package Test 39 | * @subpackage Tcp 40 | * @author Marcelo Gornstein 41 | * @license http://marcelog.github.com/ Apache License 2.0 42 | * @link http://marcelog.github.com/ 43 | */ 44 | class Test_Tcp_Peer extends PHPUnit_Framework_TestCase 45 | { 46 | /** 47 | * @test 48 | */ 49 | public function can_use_peer() 50 | { 51 | $peer = new \Ding\Helpers\Tcp\TcpPeer('address', 'port', null); 52 | $this->assertEquals('address', $peer->getAddress()); 53 | $this->assertEquals('port', $peer->getPort()); 54 | $this->assertEquals('address:port', $peer->getName()); 55 | $this->assertNull($peer->getSocket()); 56 | $this->assertFalse($peer->hasActivity()); 57 | } 58 | } --------------------------------------------------------------------------------