Runtime configuration ===================== .. sectionauthor:: Bernhard Posselt The App Framework assembles the application by using an Inversion of Control container which does :doc:`../general/dependencyinjection`. Dependency Injection helps you to create testable code. For a very simple and good Tutorial, watch the `Dependency Injection and the art of Services and Containers Tutorial on YouTube `_. A broader overview over how it works and what the benefits are can be seen on `Google's Clean Code Talks `_. The container is configured in :file:`dependencyinjection/dicontainer.php`. By default `Pimple `_ is used as dependency injection container. A `tutorial can be found here `_ To add your own classes simply open the :file:`dependencyinjection/dicontainer.php` and add a line like this to the constructor: .. code-block:: php ` API abstraction layer ===================== .. sectionauthor:: Bernhard Posselt ownCloud currently has a ton of static methods which is a very bad thing concerning testability. Therefore the App Framework comes with an :php:class:`OCA\\AppFramework\\Core\\API` abstraction layer (basically a `facade `_) which wraps the static method calls inside an object. .. note:: This is a temporary solution until ownCloud offers a proper API with normal classes that can be used in the DIContainer. This will allow you to easily mock the API in your unittests. Extend the API -------------- If you find yourself in need to use more ownCloud internal static methods simply inherit from the API class: :file:`core/api.php` .. code-block:: php appName, $someParam); } } and wire it up in the container: :file:`dependencyinjection/dicontainer.php` .. code-block:: php share(function($c){ return new API($c['AppName']); }); } } ?>