From a56c565c4826e9529d3b28ff27f200d3a92f598a Mon Sep 17 00:00:00 2001 From: Yuvraj Singh Date: Wed, 24 Jun 2015 22:04:25 +0530 Subject: [PATCH 1/6] Finish Annottation Plugin Manager --- src/Annotation/EmbedType.php | 7 +++++++ src/EmbedTypeInterface.php | 9 +++++++++ src/EmbedTypeManager.php | 19 +++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/src/Annotation/EmbedType.php b/src/Annotation/EmbedType.php index 0b4212c..fff1bcd 100644 --- a/src/Annotation/EmbedType.php +++ b/src/Annotation/EmbedType.php @@ -41,4 +41,11 @@ class EmbedType extends Plugin { */ protected $embed_form_class; + /** + * + * + * @var string + */ + protected $category; + } diff --git a/src/EmbedTypeInterface.php b/src/EmbedTypeInterface.php index 19bce56..5684260 100644 --- a/src/EmbedTypeInterface.php +++ b/src/EmbedTypeInterface.php @@ -59,4 +59,13 @@ public function label(); */ public function getEmbedFormClass(); + /** + * + * + * @returns string + * The name of the category that is embed. + * + */ + public function getCategory(); + } diff --git a/src/EmbedTypeManager.php b/src/EmbedTypeManager.php index c6a8440..8e97a77 100644 --- a/src/EmbedTypeManager.php +++ b/src/EmbedTypeManager.php @@ -36,4 +36,23 @@ public function __construct(\Traversable $namespaces, CacheBackendInterface $cac $this->setCacheBackend($cache_backend, 'embed_type_plugins'); } + /** + * Determines the Plugins that satisfy a particular category. + * + * @param string $category + * A string of type category. + * + * @return array + * An array of plugin definitions. + * + */ + public function getDefinitionForCategory($category){ + $definitions = $this->getDefinitions(); + for($i = 0; $i < count($definitions); $i++){ + if($definitions[$i]->category == $category){ + array_push($definitions[$i]); + } + } + return $definitions_for_category; + } } From b9ab251423ff7565b86ef5038f7f56f78726cf50 Mon Sep 17 00:00:00 2001 From: Yuvraj Singh Date: Wed, 24 Jun 2015 22:44:51 +0530 Subject: [PATCH 2/6] Add comments --- src/EmbedTypeInterface.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/EmbedTypeInterface.php b/src/EmbedTypeInterface.php index 5684260..de8e545 100644 --- a/src/EmbedTypeInterface.php +++ b/src/EmbedTypeInterface.php @@ -36,7 +36,7 @@ public function get($property); public function set($property, $value); /** - * Returns the unique identifier of the embed type. + * Return the unique identifier of the embed type. * * @return string * The unique identifier of the embed type. @@ -44,7 +44,7 @@ public function set($property, $value); public function id(); /** - * Returns the human-readable name of the embed type. + * Return the human-readable name of the embed type. * * @return string * The human-readable name of the embed type. @@ -52,7 +52,7 @@ public function id(); public function label(); /** - * Returns the name of the embed form class associated with this embed type. + * Return the fully qualififed class name of the class which provides the embed form * * @return string * The name of the embed form class. @@ -60,11 +60,10 @@ public function label(); public function getEmbedFormClass(); /** + * Return the category for the type of the embeds. * - * - * @returns string - * The name of the category that is embed. - * + * @return string + * The name of the category. */ public function getCategory(); From f84bda100623b160f1bb92a7e38533d5882681d0 Mon Sep 17 00:00:00 2001 From: Yuvraj Singh Date: Sun, 28 Jun 2015 09:00:26 +0530 Subject: [PATCH 3/6] Edit Comments --- src/EmbedTypeManager.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/EmbedTypeManager.php b/src/EmbedTypeManager.php index 8e97a77..d313625 100644 --- a/src/EmbedTypeManager.php +++ b/src/EmbedTypeManager.php @@ -44,7 +44,6 @@ public function __construct(\Traversable $namespaces, CacheBackendInterface $cac * * @return array * An array of plugin definitions. - * */ public function getDefinitionForCategory($category){ $definitions = $this->getDefinitions(); From 5711592c65aacf7b7ed83f3632ecaf54fb599ace Mon Sep 17 00:00:00 2001 From: Yuvraj Singh Date: Wed, 1 Jul 2015 21:22:53 +0530 Subject: [PATCH 4/6] Declare variable --- src/EmbedTypeManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EmbedTypeManager.php b/src/EmbedTypeManager.php index d313625..3a74c8a 100644 --- a/src/EmbedTypeManager.php +++ b/src/EmbedTypeManager.php @@ -49,7 +49,7 @@ public function getDefinitionForCategory($category){ $definitions = $this->getDefinitions(); for($i = 0; $i < count($definitions); $i++){ if($definitions[$i]->category == $category){ - array_push($definitions[$i]); + array_push($definitions_for_category,$definitions[$i]); } } return $definitions_for_category; From 742093b71c4825e389eff81dd48b42ab42dad42c Mon Sep 17 00:00:00 2001 From: Yuvraj Singh Date: Wed, 1 Jul 2015 23:53:10 +0530 Subject: [PATCH 5/6] Add missing comments and declare the variable --- src/Annotation/EmbedType.php | 2 +- src/EmbedTypeManager.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Annotation/EmbedType.php b/src/Annotation/EmbedType.php index fff1bcd..3abd5a1 100644 --- a/src/Annotation/EmbedType.php +++ b/src/Annotation/EmbedType.php @@ -42,7 +42,7 @@ class EmbedType extends Plugin { protected $embed_form_class; /** - * + * The name of the category associated with the embed type. * * @var string */ diff --git a/src/EmbedTypeManager.php b/src/EmbedTypeManager.php index 3a74c8a..b948d2f 100644 --- a/src/EmbedTypeManager.php +++ b/src/EmbedTypeManager.php @@ -47,9 +47,10 @@ public function __construct(\Traversable $namespaces, CacheBackendInterface $cac */ public function getDefinitionForCategory($category){ $definitions = $this->getDefinitions(); - for($i = 0; $i < count($definitions); $i++){ - if($definitions[$i]->category == $category){ - array_push($definitions_for_category,$definitions[$i]); + $definitions_for_category = array(); + foreach($definitions as $definitions){ + if($definitions->category == $category){ + array_push($definitions_for_category,$definitions); } } return $definitions_for_category; From 95dd3cab9fb04ecc98026baa912bd1ecdcd94819 Mon Sep 17 00:00:00 2001 From: Yuvraj Singh Date: Thu, 2 Jul 2015 01:15:24 +0530 Subject: [PATCH 6/6] Remove category from Annotation Plugin and its supporting functions --- src/Annotation/EmbedType.php | 7 ------- src/EmbedTypeInterface.php | 8 -------- src/EmbedTypeManager.php | 19 ------------------- 3 files changed, 34 deletions(-) diff --git a/src/Annotation/EmbedType.php b/src/Annotation/EmbedType.php index 3abd5a1..0b4212c 100644 --- a/src/Annotation/EmbedType.php +++ b/src/Annotation/EmbedType.php @@ -41,11 +41,4 @@ class EmbedType extends Plugin { */ protected $embed_form_class; - /** - * The name of the category associated with the embed type. - * - * @var string - */ - protected $category; - } diff --git a/src/EmbedTypeInterface.php b/src/EmbedTypeInterface.php index de8e545..02fcc8c 100644 --- a/src/EmbedTypeInterface.php +++ b/src/EmbedTypeInterface.php @@ -59,12 +59,4 @@ public function label(); */ public function getEmbedFormClass(); - /** - * Return the category for the type of the embeds. - * - * @return string - * The name of the category. - */ - public function getCategory(); - } diff --git a/src/EmbedTypeManager.php b/src/EmbedTypeManager.php index b948d2f..c6a8440 100644 --- a/src/EmbedTypeManager.php +++ b/src/EmbedTypeManager.php @@ -36,23 +36,4 @@ public function __construct(\Traversable $namespaces, CacheBackendInterface $cac $this->setCacheBackend($cache_backend, 'embed_type_plugins'); } - /** - * Determines the Plugins that satisfy a particular category. - * - * @param string $category - * A string of type category. - * - * @return array - * An array of plugin definitions. - */ - public function getDefinitionForCategory($category){ - $definitions = $this->getDefinitions(); - $definitions_for_category = array(); - foreach($definitions as $definitions){ - if($definitions->category == $category){ - array_push($definitions_for_category,$definitions); - } - } - return $definitions_for_category; - } }