]> git.mxchange.org Git - friendica.git/commitdiff
Adding REAMDEs to directories
authorPhilipp Holzer <admin@philipp.info>
Sun, 3 Mar 2019 14:05:35 +0000 (15:05 +0100)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sat, 23 Mar 2019 02:56:57 +0000 (22:56 -0400)
src/Core/Cache.php
src/Core/Cache/CacheDriverFactory.php [deleted file]
src/Core/Lock.php
src/Core/README.md [new file with mode: 0644]
src/Factory/CacheDriverFactory.php [new file with mode: 0644]
src/Factory/README.md [new file with mode: 0644]
src/Model/README.md [new file with mode: 0644]
src/Module/README.md [new file with mode: 0644]
src/Object/README.md [new file with mode: 0644]
src/Worker/README.md [new file with mode: 0644]

index cadb2444b50e4debee4b9eff7a9f55d6e47f1d60..7a8f7367ec10597613b7ed94385bfdf85c2464f0 100644 (file)
@@ -4,7 +4,7 @@
  */
 namespace Friendica\Core;
 
-use Friendica\Core\Cache\CacheDriverFactory;
+use Friendica\Factory\CacheDriverFactory;
 
 /**
  * @brief Class for storing data for a short time
diff --git a/src/Core/Cache/CacheDriverFactory.php b/src/Core/Cache/CacheDriverFactory.php
deleted file mode 100644 (file)
index 307f52a..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
-namespace Friendica\Core\Cache;
-
-use Friendica\Core\Config;
-
-/**
- * Class CacheDriverFactory
- *
- * @package Friendica\Core\Cache
- *
- * A basic class to generate a CacheDriver
- */
-class CacheDriverFactory
-{
-       /**
-        * This method creates a CacheDriver for the given cache driver name
-        *
-        * @param string $driver The name of the cache driver
-        * @return ICacheDriver  The instance of the CacheDriver
-        * @throws \Exception    The exception if something went wrong during the CacheDriver creation
-        */
-       public static function create($driver) {
-
-               switch ($driver) {
-                       case 'memcache':
-                               $memcache_host = Config::get('system', 'memcache_host');
-                               $memcache_port = Config::get('system', 'memcache_port');
-
-                               return new MemcacheCacheDriver($memcache_host, $memcache_port);
-                               break;
-
-                       case 'memcached':
-                               $memcached_hosts = Config::get('system', 'memcached_hosts');
-
-                               return new MemcachedCacheDriver($memcached_hosts);
-                               break;
-                       case 'redis':
-                               $redis_host = Config::get('system', 'redis_host');
-                               $redis_port = Config::get('system', 'redis_port');
-
-                               return new RedisCacheDriver($redis_host, $redis_port);
-                               break;
-                       default:
-                               return new DatabaseCacheDriver();
-               }
-       }
-}
index 8bc2c242d18a588d984bb10be0c8daebd4e8e69e..a45490bf3966065990476741e64340910bb78582 100644 (file)
@@ -7,7 +7,7 @@
 
 namespace Friendica\Core;
 
-use Friendica\Core\Cache\CacheDriverFactory;
+use Friendica\Factory\CacheDriverFactory;
 use Friendica\Core\Cache\IMemoryCacheDriver;
 
 /**
diff --git a/src/Core/README.md b/src/Core/README.md
new file mode 100644 (file)
index 0000000..8a5a378
--- /dev/null
@@ -0,0 +1,4 @@
+## Friendica\Core
+
+The Core namespace contains classes, which are essential to Friendica.
\ No newline at end of file
diff --git a/src/Factory/CacheDriverFactory.php b/src/Factory/CacheDriverFactory.php
new file mode 100644 (file)
index 0000000..1008b67
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+
+namespace Friendica\Factory;
+
+use Friendica\Core\Cache\ICacheDriver;
+use Friendica\Core\Config;
+use Friendica\Core\Cache;
+
+/**
+ * Class CacheDriverFactory
+ *
+ * @package Friendica\Core\Cache
+ *
+ * A basic class to generate a CacheDriver
+ */
+class CacheDriverFactory
+{
+       /**
+        * This method creates a CacheDriver for the given cache driver name
+        *
+        * @param string $driver The name of the cache driver
+        * @return ICacheDriver  The instance of the CacheDriver
+        * @throws \Exception    The exception if something went wrong during the CacheDriver creation
+        */
+       public static function create($driver) {
+
+               switch ($driver) {
+                       case 'memcache':
+                               $memcache_host = Config::get('system', 'memcache_host');
+                               $memcache_port = Config::get('system', 'memcache_port');
+
+                               return new Cache\MemcacheCacheDriver($memcache_host, $memcache_port);
+                               break;
+
+                       case 'memcached':
+                               $memcached_hosts = Config::get('system', 'memcached_hosts');
+
+                               return new Cache\MemcachedCacheDriver($memcached_hosts);
+                               break;
+                       case 'redis':
+                               $redis_host = Config::get('system', 'redis_host');
+                               $redis_port = Config::get('system', 'redis_port');
+
+                               return new Cache\RedisCacheDriver($redis_host, $redis_port);
+                               break;
+                       default:
+                               return new Cache\DatabaseCacheDriver();
+               }
+       }
+}
diff --git a/src/Factory/README.md b/src/Factory/README.md
new file mode 100644 (file)
index 0000000..572d940
--- /dev/null
@@ -0,0 +1,9 @@
+## Friendica\Factory
+
+This namespace contains Factories.
+A Factory is used to create specific objects based on its configuration.
+
+See [Factory Method](https://designpatternsphp.readthedocs.io/en/latest/Creational/FactoryMethod/README.html)
+
+Use the classes inside this directory if you want to change the way how new objects should get created.
+Don't use the classes to change the behaviour of the concrete objects.
diff --git a/src/Model/README.md b/src/Model/README.md
new file mode 100644 (file)
index 0000000..fb41e73
--- /dev/null
@@ -0,0 +1,5 @@
+### Friendica\Model
+
+Models are the glue between the business logic of the app and the datastore(s).
+
+In the namespace Model should only be static classes that interact with the DB with the same name as a database table.
\ No newline at end of file
diff --git a/src/Module/README.md b/src/Module/README.md
new file mode 100644 (file)
index 0000000..f888f26
--- /dev/null
@@ -0,0 +1,10 @@
+## Friendica\Module
+
+The Module namespace contains the different modules of Friendica.
+Each module is loaded through the [`App`](https://github.com/friendica/friendica/blob/develop/src/App.php).
+
+Rules for Modules:
+-      Named like the call (i.e. https://friendica.test/contact => `Contact`)
+-      Start with capitals and are **not** camelCased.
+-      Directly interacting with a given request (POST or GET)
+-      Extending [`BaseModule`](https://github.com/friendica/friendica/blob/develop/src/BaseModule.php).
\ No newline at end of file
diff --git a/src/Object/README.md b/src/Object/README.md
new file mode 100644 (file)
index 0000000..e4089db
--- /dev/null
@@ -0,0 +1,5 @@
+## Friendica\Object
+
+The namespace Object contains dynamic classes which are **note** directly interacting with the datastore.
+
+They are used to implement business logic for a particular object (i.e. an Image). 
\ No newline at end of file
diff --git a/src/Worker/README.md b/src/Worker/README.md
new file mode 100644 (file)
index 0000000..fc937b3
--- /dev/null
@@ -0,0 +1,6 @@
+## Friendica\Worker
+
+The Worker namespace contains all asynchronous workers of Friendica.
+The all have to implement the function `public static function execute()`.
+
+They are all executed by the [`Worker`](https://github.com/friendica/friendica/blob/develop/src/Core/Worker.php).
\ No newline at end of file