Skip to content

Commit 89dafac

Browse files
m1guelpfacrobat
authored andcommitted
Add a helper fromFile function to get GraphQL queries from a file (KnpLabs#628)
1 parent 15dcea2 commit 89dafac

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/Github/Api/GraphQL.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,15 @@ public function execute($query, array $variables = array())
3232

3333
return $this->post('/graphql', $params);
3434
}
35+
36+
/**
37+
* @param string $file
38+
* @param array $variables
39+
*
40+
* @return array
41+
*/
42+
public function fromFile($file, array $variables = array())
43+
{
44+
return $this->execute(file_get_contents($file), $variables);
45+
}
3546
}

0 commit comments

Comments
 (0)