From d3270ba6e72f088f3e8791ced0797c41e5ab302d Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Sat, 9 May 2020 23:05:29 -0400 Subject: [PATCH] - First commit --- LICENSE | 21 +++++++++++++++++++++ composer.json | 31 +++++++++++++++++++++++++++++++ src/Annotation/Language.php | 17 +++++++++++++++++ src/LanguageHandler.php | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 101 insertions(+) create mode 100644 LICENSE create mode 100644 composer.json create mode 100644 src/Annotation/Language.php create mode 100644 src/LanguageHandler.php diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..cb3012e --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 Dave Mc Nicoll + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..8d22775 --- /dev/null +++ b/composer.json @@ -0,0 +1,31 @@ +{ + "name": "mcnd/notes-tell", + "description": "A library linking Notes and Tell together.", + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Dave Mc Nicoll", + "email": "mcndave@gmail.com" + } + ], + "require": { + "mcnd/notes": "master-dev", + "mcnd/tell": "master-dev" + }, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/mcNdave/notes.git" + }, + { + "type": "vcs", + "url": "https://github.com/mcNdave/tell.git" + } + ], + "autoload": { + "psr-4": { + "Notes\\Tell\\": "src/" + } + } +} diff --git a/src/Annotation/Language.php b/src/Annotation/Language.php new file mode 100644 index 0000000..8a35c92 --- /dev/null +++ b/src/Annotation/Language.php @@ -0,0 +1,17 @@ +key = $key; + } + + } + +} diff --git a/src/LanguageHandler.php b/src/LanguageHandler.php new file mode 100644 index 0000000..5713407 --- /dev/null +++ b/src/LanguageHandler.php @@ -0,0 +1,32 @@ +getClassAnnotations($className); + + # Should generate an equivalent of Ulmus's object reflection here ! + if ( $annotation->key ) { + return $annotation; + } + + return null; + } + + protected function getClassAnnotations(string $className) : \Notes\Annotation + { + $objectResolver = new ObjectResolver($className, true, true, false, true); + + if ( null !== ( $object = $objectResolver->getAnnotationFromClassname( Annotation\Language::class ) ) ) { + return $object; + } + } + +}