You are here

function patterns_phpparser_parse in Patterns 7

Same name and namespace in other branches
  1. 7.2 patterns_phpparser/patterns_phpparser.module \patterns_phpparser_parse()

Parses a string containing a PHP array and returns the array.

Parameters

array $pattern The pattern string to convert array.:

2 calls to patterns_phpparser_parse()
patterns_phpparser_load in patterns_phpparser/patterns_phpparser.module
Loads a serialized PHP pattern array from file.
patterns_phpparser_load_new in patterns_phpparser/patterns_phpparser.module
Loads and parses a PHP pattern from file.

File

patterns_phpparser/patterns_phpparser.module, line 65

Code

function patterns_phpparser_parse($pattern = NULL) {
  if (is_null($pattern)) {
    return FALSE;
  }
  if (is_array($pattern)) {
    return $pattern;
  }
  if (!is_string($pattern)) {
    return FALSE;
  }
  return unserialize($pattern);
}