Returns AClassContent whom classname matches the provided pattern.

@param string $pattern The pattern to test

@param  string      $pattern The pattern to test
@return array|FALSE An array of classnames matching the pattern of FALSE if none found
343857
public function glob($pattern)
    {
        // $pattern = 'Media'.DIRECTORY_SEPARATOR.'*'
        $wrappers = $this->getStreamWrapperClassname('BackBee\ClassContent', 'bb.class');
        if (0 == count($wrappers)) {
            return false;
        }

        $classnames = array();
        foreach ($wrappers as $classname) {
            $wrapper = new $classname();
            if (false !== $matchingclass = $wrapper->glob($pattern)) {
                $classnames = array_merge($classnames, $matchingclass);
            }
        }

        if (0 == count($classnames)) {
            return false;
        }

        return array_unique($classnames);
    }
32731
private function getMethods($pattern = "/^action_/") {
		$methos = get_class_methods($this->class);
		$actions = array();

		foreach ($methos as $methodName) {
			if (preg_match($pattern, $methodName)) {
				array_push($actions, $methodName);
			}
		}
		return $actions;
	}
909404
private static function firstWildcardInPattern($pattern)
    {
        $wildcards = ['*', '?', '[', '\\'];
        $wildcardSearch = function ($carry, $item) use ($pattern) {
            $position = strpos($pattern, $item);

            if ($position === false) {
                return $carry === false ? $position : $carry;
            }

            return $carry === false ? $position : min($carry, $position);
        };

        return array_reduce($wildcards, $wildcardSearch, false);
    }
1246162
public function name($pattern)
	{
		$regex = FilenameMatch::translate($pattern);
		$this->names[] = $regex;

		return $this;
	}
345226
private function findinvirtual($pattern)
    {
        $result = array();
        $virtual = null;

        if ($this->file)
            $virtual = file($this->file);

        if (empty($virtual))
            return $result;

        // check each line for matches
        foreach ($virtual as $line) {
            $line = trim($line);
            if (empty($line) || $line[0]=='#')
                continue;

            if (preg_match($pattern, $line))
                $result[] = $line;
        }

        return $result;
    }
1153734
protected function getFileIterator($path, $pattern = '/^.+\.php$/')
    {
        if (is_dir($path)) {
            return new \RegexIterator(new \DirectoryIterator($path), $pattern, \RegexIterator::GET_MATCH);
        }
        if (is_file($path) && 1 === preg_match($pattern, $path)) {
            return [new \SplFileInfo($path)];
        }
        return [];
    }
212524
private function matches($pattern, $event)
    {
        return (Str::contains($pattern, '*') && Str::is($pattern, $event))
            || Str::startsWith($event, $pattern);
    }
956394
protected static function extract($pattern)
    {
        if (str_contains($pattern, '|')) {
            $segements = explode('|', $pattern);

            $events[$segements[0]] = explode('.', $segements[1]);
        } else {
            $segements = explode('.', $pattern);

            $events[$segements[0]] = $segements[1];
        }

        return $events;
    }
984408
public function startsWith($pattern)
  {
    return (substr($this->string, 0, strlen($pattern)) == $pattern) ? TRUE : FALSE;
  }
447516
public function pattern($pattern = null)
        {
            if ($pattern === null) return $this->rulePattern;

            $this->rulePattern = $pattern;

            return $this;
        }
1088835
public function notMatch($pattern) {
        if (!$this->_isValid) {
            return $this;
        }
        if (preg_match($pattern, $this->_unsafeVar)) {
            $this->_isValid = false;
        }
        return $this;
    }
1177076
public function readWithPattern($text, $pattern) {
		$pieces = explode("\n", $text);
		$result = [];
		foreach ($pieces as $piece) {
			$result[] = sscanf(trim($piece, "\r\n"), $pattern);
		}
		return $result;
	}
1055744
public function match($pattern) {
        if (!$this->_isValid) {
            return $this;
        }
        if (!preg_match($pattern, $this->_unsafeVar)) {
            $this->_isValid = false;
        }
        return $this;
    }
943207
public function transformPatternToRegex($pattern)
    {
        if (!isset($this->patternToRegexpCache[$pattern])) {
            $this->patternToRegexpCache[$pattern] = $this->transformPatternToRegexWithSupportedPolicy($pattern);
        }

        return $this->patternToRegexpCache[$pattern];
    }
1048954
protected function compile($pattern)
    {
        if (isset($this->compileCache[$pattern])) {
            return $this->compileCache[$pattern];
        }

        $pcre = '(^';

        do {
            switch (true) {
                case preg_match('(^[^{]+)', $pattern, $match):
                    $pattern = substr($pattern, strlen($match[0]));
                    $pcre .= preg_quote($match[0]);
                    break;

                case preg_match('(^' . self::STANDARD_VARIABLE_REGEX . ')', $pattern, $match):
                    $pattern = substr($pattern, strlen($match[0]));
                    $pcre .= '(?P<' . $match[1] . '>[^/]+)';
                    break;

                case preg_match('(^' . self::SLASHES_VARIABLE_REGEX . ')', $pattern, $match):
                    $pattern = substr($pattern, strlen($match[0]));
                    $pcre .= '(?P<' . $match[1] . '>.+)';
                    break;

                default:
                    throw new Exceptions\InvalidArgumentException("Invalid pattern part: '$pattern'.");
            }
        } while ($pattern);

        $pcre .= '$)S';

        $this->compileCache[$pattern] = $pcre;

        return $pcre;
    }
291688
public function rule($pattern)
    {
        $rewrite = $this->container->make(Rewrite::class);

        $rewrite->setPattern($pattern);

        return $this->hang($rewrite);
    }
798345
protected static function key_matcher(array $pattern)
    {
        $keys = [];
        foreach ($pattern as $k => $v) {
            $chars = ['?' => [0, 1], '*' => [0, PHP_INT_MAX], '!' => [1, 1]];
            if (isset($chars[$last = substr($k, -1)])) {
                $keys[$k = substr($k, 0, -1)] = $chars[$last];
            } elseif ($last == '}') {
                list($k, $range) = explode('{', $k);
                $range = explode(',', rtrim($range, '}'));
                $keys[$k] = count($range) == 1
                    ? [$range[0], $range[0]]
                    : [$range[0] === '' ? 0 : $range[0], $range[1] === '' ? PHP_INT_MAX : $range[1]];
            } else {
                $keys[$k] = $chars[$k[0] == ':' ? '*' : '!'];
            }
            array_push($keys[$k], $v, 0);
        }

        return function ($key = null, $value = null) use (&$keys) {
            if (is_null($key)) foreach ($keys as $count) {
                if ($count[3] < $count[0] || $count[3] > $count[1]) return false;
            } else foreach ($keys as $k => &$count) if (self::matcher($key, $k)) {
                if (!self::matches($value, $count[2])) return false;
                $count[3]++;
            }
            return true;
        };
    }