Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
FNSO
I-FAIR IR
Circe Php Client
Commits
9dc95366
Commit
9dc95366
authored
Mar 18, 2021
by
Mickael Desfrenes
Browse files
add convenience methods to JobResult
parent
fd857920
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Certic/Circe/JobResult.php
View file @
9dc95366
...
...
@@ -19,6 +19,31 @@ class JobResult
}
}
public
function
getDocuments
():
\
Iterator
{
foreach
(
$this
->
getFiles
()
as
$file
)
{
if
(
!
in_array
(
$file
->
getFileName
(),
[
'out.log'
,
'job.json'
]))
{
yield
$file
;
}
}
}
public
function
getLog
():
\
Iterator
{
foreach
(
$this
->
getFiles
()
as
$file
){
if
(
$file
->
getFileName
()
==
'out.log'
){
$content
=
file_get_contents
((
string
)
$file
);
$lines
=
explode
(
PHP_EOL
,
$content
);
foreach
(
$lines
as
$line
){
$entry
=
json_decode
(
$line
,
true
);
if
(
$entry
){
yield
$entry
;
}
}
}
}
}
public
function
__destruct
()
{
@
\
unlink
(
$this
->
result_file_path
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment