Skip to content

Instantly share code, notes, and snippets.

@e2thex
Created July 12, 2012 13:34
Show Gist options
  • Select an option

  • Save e2thex/3098139 to your computer and use it in GitHub Desktop.

Select an option

Save e2thex/3098139 to your computer and use it in GitHub Desktop.
Plugin Factory validatePluginInfoElement
<?php
/**
* Validate that the plugin info array contains the all of the required keys
*
* @param $plugin_info
* @param $element_key
* @param $element
*
* @throws Exception\InvalidPluginException
*
*
* @return \Drupal\sps\PluginFactory
* self
*/
protected function validatePluginInfoElement($plugin_info, $element_key, $element) {
if (is_array($element)) {
if (!isset($plugin_info[$element_key])) {
throw new InvalidPluginException(
"Plugin {$plugin_info['name']} does not contain required element $element_key");
}
}
else {
if (!isset($plugin_info[$element])) {
throw new InvalidPluginException(
"Plugin {$plugin_info['name']} does not contain required element $element");
}
}
return $this;
}
@e2thex
Copy link
Copy Markdown
Author

e2thex commented Jul 12, 2012

So I am thining that this function does not do what it is suppose to do, but I want to see if you had any idea on what it might be trying to do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment