From 80a40f774bb5e97534529dc09af47bfdbb3520fa Mon Sep 17 00:00:00 2001 From: Jaime Rodriguez Date: Thu, 30 Jul 2020 21:34:54 -0700 Subject: [PATCH] update: 2.x branch compatibility --- class.csv.php => Document.php | 54 ++++++++++++++++++++++++++--------- csv_test.php | 3 ++ 2 files changed, 44 insertions(+), 13 deletions(-) rename class.csv.php => Document.php (85%) diff --git a/class.csv.php b/Document.php similarity index 85% rename from class.csv.php rename to Document.php index f2d4d90..02ab1af 100644 --- a/class.csv.php +++ b/Document.php @@ -1,24 +1,42 @@ + * @license https://opensource.org/licenses/MIT MIT + * @version GIT: 1.0.0 + * @link http://sleepymustache.com + */ + namespace Module\CSV; +use Sleepy\Core\Hook; +use Sleepy\Core\Module; + /** * Creates a Comma Separated Value file. * * ### Usage * * - * // loads a existing CSV file - * $c = new \Module\CSV\Document('presidents.csv'); - * - * $c->add(array( - * 'George', - * 'Washington' - * )); - * + * use \Module\CSV\Document; + * + * // Load a file + * $c = new Document('presidents.csv'); + * + * // Add a entry, then save. + * $c->add(['George', 'Washington']); * $c->save(); * * * ### Changelog + * + * ##Version 2.0 + * * Made compatible with 2.x branch * * ##Version 1.9 * * Added ability to use your own filename in the show method @@ -35,12 +53,19 @@ * * check if we can remove the header before doing it... teamsite issue. * * suppress flock warnings... teamsite issue * - * @date August 13, 2014 - * @author Jaime A. Rodriguez - * @version 1.8 - * @license http://opensource.org/licenses/MIT + * @category Data Storage and Manipulation + * @package Module/Performance + * @author Jaime Rodriguez + * @license https://opensource.org/licenses/MIT MIT + * @link http://sleepymustache.com */ -class Document { +class Document extends Module +{ + /** + * Define the hook points + */ + public $hooks = []; + /** * string The filename of the CSV file */ @@ -262,3 +287,6 @@ public function show() { $this->save(); } } + + +Hook::register(new Document()); diff --git a/csv_test.php b/csv_test.php index 0f0816c..cf369d7 100644 --- a/csv_test.php +++ b/csv_test.php @@ -1,4 +1,7 @@