From c4a005a69a854682f064016d428d23e50c6e9dee Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Sat, 15 Dec 2018 16:23:19 +0100 Subject: Flywheel extension and custom json formatter --- app/class/wflywheel/formatter/json.php | 20 ++++++++++++++++++++ app/class/wflywheel/predicate.php | 11 +++++++++++ app/class/wflywheel/query.php | 16 ++++++++++++++++ app/class/wflywheel/repository.php | 30 ++++++++++++++++++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 app/class/wflywheel/formatter/json.php create mode 100644 app/class/wflywheel/predicate.php create mode 100644 app/class/wflywheel/query.php create mode 100644 app/class/wflywheel/repository.php (limited to 'app/class/wflywheel') diff --git a/app/class/wflywheel/formatter/json.php b/app/class/wflywheel/formatter/json.php new file mode 100644 index 0000000..8583802 --- /dev/null +++ b/app/class/wflywheel/formatter/json.php @@ -0,0 +1,20 @@ +operators = array( + '>', '>=', '<', '<=', '==', '===', '!=', '!==', 'IN' + ); + } +} diff --git a/app/class/wflywheel/query.php b/app/class/wflywheel/query.php new file mode 100644 index 0000000..49aff16 --- /dev/null +++ b/app/class/wflywheel/query.php @@ -0,0 +1,16 @@ +predicate = new Predicate(); + } +} diff --git a/app/class/wflywheel/repository.php b/app/class/wflywheel/repository.php new file mode 100644 index 0000000..baad42e --- /dev/null +++ b/app/class/wflywheel/repository.php @@ -0,0 +1,30 @@ +formatter->getFileExtension(); + $files = glob($this->path . DIRECTORY_SEPARATOR . '*.' . $ext); + return $files; + } + + /** + * Get an array containing the id of all files in this repository + * + * @return array An array, item is a id + */ + public function getAllIds() + { + $ext = $this->formatter->getFileExtension(); + return array_map(function($path) use ($ext) { + return $this->getIdFromPath($path, $ext); + }, $this->getAllFiles()); + } +} -- cgit v1.2.3