You are here

public static function FeedsExJsonUtility::jmesPathParserInstalled in Feeds extensible parsers 7

Determines if a JMESPath parser is installed.

Return value

bool True if a parser is installed, false if not.

2 calls to FeedsExJsonUtility::jmesPathParserInstalled()
FeedsExJmesPath::loadLibrary in src/FeedsExJmesPath.inc
Loads the necessary library.
feeds_ex_feeds_plugins in ./feeds_ex.feeds.inc
Implements hook_feeds_plugins().

File

src/Json/Utility.php, line 230
Contains FeedsExJsonUtility.

Class

FeedsExJsonUtility
Various helpers for handling JSON.

Code

public static function jmesPathParserInstalled() {
  if (class_exists('JmesPath\\AstRuntime') || class_exists('JmesPath\\Runtime\\AstRuntime')) {
    return TRUE;
  }
  $path = feeds_ex_library_path('jmespath.php', 'vendor/autoload.php');
  if (!$path && is_file(DRUPAL_ROOT . '/vendor/autoload.php')) {

    // This can exist when running tests on drupal.org.
    $path = 'vendor/autoload.php';
  }
  if (!$path) {
    return FALSE;
  }
  require_once DRUPAL_ROOT . '/' . $path;
  return class_exists('JmesPath\\AstRuntime') || class_exists('JmesPath\\Runtime\\AstRuntime');
}