Adding REAMDEs to directories

This commit is contained in:
Philipp Holzer 2019-03-03 15:05:35 +01:00 committed by Hypolite Petovan
parent 3261ffbd99
commit 8237e73e26
9 changed files with 48 additions and 7 deletions

View File

@ -4,7 +4,7 @@
*/ */
namespace Friendica\Core; namespace Friendica\Core;
use Friendica\Core\Cache\CacheDriverFactory; use Friendica\Factory\CacheDriverFactory;
/** /**
* @brief Class for storing data for a short time * @brief Class for storing data for a short time

View File

@ -7,7 +7,7 @@
namespace Friendica\Core; namespace Friendica\Core;
use Friendica\Core\Cache\CacheDriverFactory; use Friendica\Factory\CacheDriverFactory;
use Friendica\Core\Cache\IMemoryCacheDriver; use Friendica\Core\Cache\IMemoryCacheDriver;
/** /**

4
src/Core/README.md Normal file
View File

@ -0,0 +1,4 @@
## Friendica\Core
The Core namespace contains classes, which are essential to Friendica.

View File

@ -1,8 +1,10 @@
<?php <?php
namespace Friendica\Core\Cache; namespace Friendica\Factory;
use Friendica\Core\Cache\ICacheDriver;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\Cache;
/** /**
* Class CacheDriverFactory * Class CacheDriverFactory
@ -27,22 +29,22 @@ class CacheDriverFactory
$memcache_host = Config::get('system', 'memcache_host'); $memcache_host = Config::get('system', 'memcache_host');
$memcache_port = Config::get('system', 'memcache_port'); $memcache_port = Config::get('system', 'memcache_port');
return new MemcacheCacheDriver($memcache_host, $memcache_port); return new Cache\MemcacheCacheDriver($memcache_host, $memcache_port);
break; break;
case 'memcached': case 'memcached':
$memcached_hosts = Config::get('system', 'memcached_hosts'); $memcached_hosts = Config::get('system', 'memcached_hosts');
return new MemcachedCacheDriver($memcached_hosts); return new Cache\MemcachedCacheDriver($memcached_hosts);
break; break;
case 'redis': case 'redis':
$redis_host = Config::get('system', 'redis_host'); $redis_host = Config::get('system', 'redis_host');
$redis_port = Config::get('system', 'redis_port'); $redis_port = Config::get('system', 'redis_port');
return new RedisCacheDriver($redis_host, $redis_port); return new Cache\RedisCacheDriver($redis_host, $redis_port);
break; break;
default: default:
return new DatabaseCacheDriver(); return new Cache\DatabaseCacheDriver();
} }
} }
} }

9
src/Factory/README.md Normal file
View File

@ -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.

5
src/Model/README.md Normal file
View File

@ -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.

10
src/Module/README.md Normal file
View File

@ -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).

5
src/Object/README.md Normal file
View File

@ -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).

6
src/Worker/README.md Normal file
View File

@ -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).