summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-12-13 19:28:20 +0100
committerMorris Jobke <hey@morrisjobke.de>2014-12-23 09:50:42 +0100
commitf1951237653ffbbf7fd75f815f401783658cec5e (patch)
tree360c85776f363e4b4447272c96c06d25863138d1 /lib/public
parentd8f04f5a97e77bf5fb84b05ddd9b3a476fecfb7c (diff)
downloadnextcloud-server-f1951237653ffbbf7fd75f815f401783658cec5e.tar.gz
nextcloud-server-f1951237653ffbbf7fd75f815f401783658cec5e.zip
Intelligent container
* resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/appframework/app.php16
-rw-r--r--lib/public/appframework/queryexception.php28
2 files changed, 44 insertions, 0 deletions
diff --git a/lib/public/appframework/app.php b/lib/public/appframework/app.php
index 21612327879..da405262aef 100644
--- a/lib/public/appframework/app.php
+++ b/lib/public/appframework/app.php
@@ -37,6 +37,22 @@ use OC\AppFramework\routing\RouteConfig;
* to be registered using IContainer::registerService
*/
class App {
+
+
+ /**
+ * Turns an app id into a namespace by convetion. The id is split at the
+ * underscores, all parts are camelcased and reassembled. e.g.:
+ * some_app_id -> OCA\SomeAppId
+ * @param string $appId the app id
+ * @param string $topNamespace the namespace which should be prepended to
+ * the transformed app id, defaults to OCA\
+ * @return string the starting namespace for the app
+ */
+ public static function buildAppNamespace($appId, $topNamespace='OCA\\') {
+ return \OC\AppFramework\App::buildAppNamespace($appId, $topNamespace);
+ }
+
+
/**
* @param array $urlParams an array with variables extracted from the routes
*/
diff --git a/lib/public/appframework/queryexception.php b/lib/public/appframework/queryexception.php
new file mode 100644
index 00000000000..f08d5b9a12f
--- /dev/null
+++ b/lib/public/appframework/queryexception.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * ownCloud - App Framework
+ *
+ * @author Bernhard Posselt
+ * @copyright 2014 Bernhard Posselt <dev@bernhard-posselt.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\AppFramework;
+
+use Exception;
+
+
+class QueryException extends Exception {}