Gitamin\Services\Git\Repository::searchTree PHP Méthode

searchTree() public méthode

public searchTree ( $query, $branch )
    public function searchTree($query, $branch)
    {
        $query = escapeshellarg($query);
        try {
            $results = $this->getClient()->run($this, "grep -i --line-number {$query} {$branch}");
        } catch (\RuntimeException $e) {
            return false;
        }
        $results = explode("\n", $results);
        foreach ($results as $result) {
            if ($result == '') {
                continue;
            }
            preg_match_all('/([\\w-._]+):([^:]+):([0-9]+):(.+)/', $result, $matches, PREG_SET_ORDER);
            $data['branch'] = $matches[0][1];
            $data['file'] = $matches[0][2];
            $data['line'] = $matches[0][3];
            $data['match'] = $matches[0][4];
            $searchResults[] = $data;
        }
        return $searchResults;
    }