From 7ee20c2d1751bf302286907e105f3134e4b64761 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 12 Dec 2016 01:07:23 +0100 Subject: [PATCH] update README + notice for filedriver:1.0 --- README.md | 6 +- notice/filedriver/1.0.md | 76 +++++++++++++++++++ .../filedriver/1.0/core/FileDriver.php | 24 ------ 3 files changed, 81 insertions(+), 25 deletions(-) create mode 100644 notice/filedriver/1.0.md diff --git a/README.md b/README.md index 0cfd624..10afe5b 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ xdrm-framework is based on `all in config` so you will have this structure : - `__CONFIG__` - The absolute `config` folder path -### 3. Modules +### 3. Packages #### 3.1 API - self-managed API @@ -60,6 +60,10 @@ xdrm-framework is based on `all in config` so you will have this structure : > version 1.0 - [documentation](/notice/log/1.0.md) +#### 3.3 Log - optimized file driver + +> version 1.0 - [documentation](/notice/filedriver/1.0.md) + #### [3.2] error - error system #### [3.3] database - database wrapper and repository manager diff --git a/notice/filedriver/1.0.md b/notice/filedriver/1.0.md new file mode 100644 index 0000000..b668571 --- /dev/null +++ b/notice/filedriver/1.0.md @@ -0,0 +1,76 @@ +```yaml +module: filedriver +version: 1.0 +requires: null +``` + +Overview +---- + +##### 1. Introduction +The `filedriver` package allows create, read and write files easily and with optimization (cf. SplFileObject). + +To make it easier and generic, all methods are static. + +Setup +---- +> 1. Include the autoloader + +```php + 2. Load the `FileDriver` class + +```php + ```php + ```php + ```php + ```php + ```php + File to read - * @line Line to read - * - */ - public static function writeline($file, $line){ - /* (0) Checks arguments */ - if( !is_string($file) || intval($line) !== $line ) - throw new \Exception('Wrong argument for writeline(, ).'); - - /* (1) Initializing driver on file (read-flag) */ - $driver = new \SplFileObject($file, 'r'); - - /* (2) Goto specific line */ - $driver->seek($line); - - /* (3) Return line's content */ - if( $driver->key() == $line ) - return $driver->current(); - else - return null; - } - /* WRITES CONTENT TO A FILE *